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?