Remove standard maven-compiler plugin for applications with boot parent
See original GitHub issueWhat needs to be done
Provide a recipe remove-redundant-maven-compiler-plugin
that removes redundant maven-compiler-plugin
configurations in Spring Boot applications that have a spring-boot parent where the compiler-plugin is managed.
Why it needs to be done
Cleaner pom.xml by using Spring Boot’s plugin management
Acceptance Criteria
Given: A pom.xml with direct or indirect spring-boot-starter-parent and a standard maven-compiler-plugin
configuration with only source
and target
When: remove-redundant-maven-compiler-plugin
is applied
Then: The maven-compiler-plugin
is removed and Properties defining the java version are replaced with java.version
property used by boot.
Additional Information
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to Disable a Maven Plugin Defined in a Parent POM
First, let's assume that restructuring the Maven project or changing the parent POM aren't acceptable solutions. If we could amend the parent ......
Read more >Apache Maven Compiler Plugin
org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile. Description: ... Binds by default to the lifecycle phase: compile.
Read more >Spring Boot Maven Plugin Documentation
The parent project provides the following features: Java 1.8 as the default compiler level. UTF-8 source encoding. Compilation with -parameters ...
Read more >which dependencies to delete from Eclipse for maven project ...
I used the most recent version of Spring Boot 2.7.4 if you need something lower change the parent (and only change that nothing...
Read more >Migrating a Spring Boot application to Java 17 – the hard way
3[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project app-project: Fatal ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think i get it. Let me start and I will reach out if I get stuck
Hi @ahmedmq, thanks for your analysis!
Your observations are all correct for my understanding.
I can see the recipe doing two things:
. Always clean up properties . When no additional configuration is provided, remove the plugin
Clean up properties
target
and sourceversion
differ, do nothingOtherwise
maven.compiler.source
andmaven.compiler.target
should be retrieved from parentjava.version
maven-compiler-plugin
should be replaced withmaven.compiler.*
java.version
maven.compiler.*
properties set throughjava.version
PlatUML code: gh428.puml.txt
Removing the plugin
It’s probably a good idea to have two
Action
s, one cleaning up the properties and one actually removing the plugin. This would allow us to use them separately (in two recipes) when needed.Your thoughts on this?