openrewrite / openrewrite/rewrite
Allow partial update of maven plugin configuration
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 3.7k
- Forks
- 570
- Avg merge
- 13h 12m
- Merged PRs (30d)
- 261
Description
What problem are you trying to solve?
Partial update of maven plugin configuration
What precondition(s) should be checked before applying this recipe?
N/A
Describe the situation before applying the recipe
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger-codegen-maven-plugin-version}</version>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/yaml/yamlfilename.yaml</inputSpec>
<language>com.my.package.for.v1.GeneratorLanguage</language>
<templateDirectory>myTemplateDir</templateDirectory>
<output>${project.build.directory}/generated-sources</output>
<apiPackage>${default.package}.handler</apiPackage>
<modelPackage>${default.package}.model</modelPackage>
<invokerPackage>${default.package}.handler</invokerPackage>
</configuration>
</plugin>
Describe the situation after applying the recipe
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger-codegen-maven-plugin-version}</version>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/yaml/yamlfilename.yaml</inputSpec>
<language>com.my.package.for.v2.GeneratorLanguage</language>
<templateDirectory>myTemplateDir</templateDirectory>
<output>${project.build.directory}/generated-sources</output>
<apiPackage>${default.package}.handler</apiPackage>
<modelPackage>${default.package}.model</modelPackage>
<invokerPackage>${default.package}.handler</invokerPackage>
</configuration>
</plugin>
Have you considered any alternatives or workarounds?
Reuse existing ChangePluginConfiguration recipe for straightforward/static configuration.
Any additional context
The tag hierarchy could change between plugin releases or when migrating from one to another plugin. So configuration elements could be customized by the teams and should be untouched. Looking for simple add/remove capabilities for tags under plugin configuration, so partial xml can be injected/removed.
Are you interested in contributing this recipe to OpenRewrite?
yes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the existing ChangePluginConfiguration recipe and its tests, then compare how plugin configuration elements are selected and changed. The work is done when a partial configuration can update the language element in the example while preserving the other customized elements, with tests covering the requested add/remove behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100