-
Notifications
You must be signed in to change notification settings - Fork 90
Remove standard maven-compiler plugin for applications with boot parent - gh-428 #508
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ahmedmq
I didn't make it through (5/23) but will proceed asap.
I think by moving more logic into Plugin
and Plugin#Configuration
some parts will get shorter and more cohesive 🤞
Thanks for your work! 🚀
...nts/sbm-core/src/main/java/org/springframework/sbm/build/impl/OpenRewriteMavenBuildFile.java
Outdated
Show resolved
Hide resolved
...nts/sbm-core/src/main/java/org/springframework/sbm/build/impl/OpenRewriteMavenBuildFile.java
Outdated
Show resolved
Hide resolved
...nts/sbm-core/src/main/java/org/springframework/sbm/build/impl/OpenRewriteMavenBuildFile.java
Outdated
Show resolved
Hide resolved
...nts/sbm-core/src/main/java/org/springframework/sbm/build/impl/OpenRewriteMavenBuildFile.java
Outdated
Show resolved
Hide resolved
...nts/sbm-core/src/main/java/org/springframework/sbm/build/impl/OpenRewriteMavenBuildFile.java
Outdated
Show resolved
Hide resolved
...nts/sbm-core/src/main/java/org/springframework/sbm/build/impl/OpenRewriteMavenBuildFile.java
Outdated
Show resolved
Hide resolved
...nts/sbm-core/src/main/java/org/springframework/sbm/build/impl/OpenRewriteMavenBuildFile.java
Outdated
Show resolved
Hide resolved
...ents/sbm-core/src/main/java/org/springframework/sbm/build/migration/actions/SetProperty.java
Show resolved
Hide resolved
...ts/sbm-core/src/main/java/org/springframework/sbm/build/migration/recipe/AddMavenPlugin.java
Show resolved
Hide resolved
...ts/sbm-core/src/main/java/org/springframework/sbm/build/migration/recipe/AddMavenPlugin.java
Show resolved
Hide resolved
@fabapp2 - Do you want to have a look at the changes done? |
- Fix typo - Generate maven properties - Change type to packaging - Add test
- Rename `Plugin.java` as `OpenRewriteMavenPlugin.java` - Extract interface from OpenRewriteMavenPlugin into `Plugin.java` - - An API interface for a potential gradle implementation in the future - Create new interface `Plugin#Configuration` and implementation - `OpenRewriteMavenPluginConfiguration`- Does not implement all methods in this commit - Refactor `Plugin#Execution` into `OpenRewriteMavenPlugin#OpenRewriteMavenPluginExecution` These changes are similar to the JavaSource rewrite approach.
setProperty() API no longer removes the maven property if the value supplied is null.
- Use Jackson XML pretty print to generate XML string for plugin configuration
- Use Plugin interface instead of OpenRewriteMavenPlugin implementation in dealing with objects
- Clean up BuildFile API - Use Java Refactoring to apply recipes via the plugin API - Disable multi-module tests as this needs core changes to POM file updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ahmedmq for your heroic effort with this contribution! 🚀
import org.springframework.sbm.engine.context.ProjectContext; | ||
import org.springframework.sbm.engine.recipe.Condition; | ||
|
||
public class SpringBootMavenCompilerExists implements Condition { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename: SpringBootMavenCompilerpLuginExists
@Override | ||
public boolean evaluate(ProjectContext context) { | ||
|
||
FileMatchingPatternExist fileMatchingPatternExist = new FileMatchingPatternExist(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about:
return context.getModules().stream()
.map(Module::getBuildFile())
.flatMap(b -> b.getPlugins().stream())
.anyMatch(p -> "maven-compiler-plugin".equals(p.getArtfactId()));
private static Stream<Arguments> input() { | ||
return Stream.of( | ||
Arguments.of( | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
formatting
@Test | ||
void removeRedundantMavenCompilerPlugin() { | ||
String applicationDir = "simple-boot"; | ||
RecipeIntegrationTestSupport.initializeProject(applicationDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💪
…nt - gh-428 (#508) - Add New recipe and condition - Enhance PomBuilder.java - Use MavenBuildFileRefactoring to apply recipe, similar to JavaRefactoring - Refactor getPlugins() method in OpenRewriteMavenBuildFile - Extract Plugin interface and refactor Maven Plugin implementation - Create new interface `Plugin#Configuration` and implementation - Refactor `Plugin#Execution` into `OpenRewriteMavenPlugin#OpenRewriteMavenPluginExecution` - Add deleteProperty() API to BuildFile - setProperty() API no longer removes the maven property if the value supplied is null. - Add maven plugin configuration to PomBuilder - Use Jackson XML pretty print to generate XML string for plugin configuration - Add findPlugins API to BuildFile - Use Plugin interface instead of OpenRewriteMavenPlugin implementation in dealing with objects - Refactor Maven compiler plugin actions - Clean up BuildFile API
Changes for #428
RemoveRedundantMavenCompilerPluginProperties
,RemoveRedundantMavenCompilerPlugin
)remove-redundant-maven-compiler-plugin.yaml
) and condition (SpringBootMavenCompilerExists
)