admin管理员组文章数量:1395381
I would like to create a shared OpenRewrite Style that, among other things, defines the import order such that there is a variable in the layout. For example:
type: specs.openrewrite/v1beta/style
name: .example.ParameterizedStyle
styleConfigs:
# .... more styles ...
- .openrewrite.java.style.ImportLayoutStyle:
classCountToUseStarImport: 999
nameCountToUseStarImport: 999
layout:
- import java.*
- <blank line>
- import javax.*
- <blank line>
- import all other imports
- <blank line>
- import ${projectRootPackage}.*
- <blank line>
- import static all other imports
I'd like users of my shared style to be able to then use my shared style and provide the variable projectRootPackage
.
Ideally, in Maven and Gradle projects, I'd also like to be able to default the projectRootPackage
value to be the group
without needing to write Maven or Gradle plugins (e.g. be able to pass the value through the existing DSL).
Does anyone have any hints as to how I can do this?
本文标签: javaHow to create Parameterized OpenRewrite StyleStack Overflow
版权声明:本文标题:java - How to create Parameterized OpenRewrite Style - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744674216a2619011.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论