-
Notifications
You must be signed in to change notification settings - Fork 85
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
flattenMode=bom removes pluginManagement #386
Comments
I'm not sure if we should preserve pluginManagement for 'bom' mode. Why do you think that should be fixed? Current behavior meet documentation for bom: Does any previous version of plugin preserve pluginManagement for bom? |
No, no previous version of this plugin preserves it for "bom" mode. However, pluginManagement is similar to dependencyManagement in that both are used to provide configuration information to child POMs. See https://www.baeldung.com/maven-plugin-management#plugin-management. Thus it makes sense to keep both dependencyManagement and pluginManagement in a BOM, which acts as a parent for other POMs. So what I'm suggesting and requesting is that "bom" mode be changed to also keep pluginManagement. Does that make sense? |
I've updated the description of the ticket to better reflect what I'm requesting. |
only
I have doubt for such change, I would like to see more opinions on it. |
i managed to keep the pluging and plugin management: <plugin>
<!-- https://www.mojohaus.org/flatten-maven-plugin/flatten-mojo.html -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<keepCommentsInPom>true</keepCommentsInPom>
<flattenMode>bom</flattenMode>
<flattenDependencyMode>all</flattenDependencyMode>
<pomElements>
<build>interpolate</build>
<properties>keep</properties>
<dependencyManagement>interpolate</dependencyManagement>
</pomElements>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin> |
Does this solution keep all of the elements in the |
you can do it like: also if you do not want to resolve properties, use keep instead interpolate. <pomElements>
<pluginManagement>interpolate</pluginManagement>
<properties>keep</properties>
<dependencyManagement>interpolate</dependencyManagement>
</pomElements> |
Thanks @rezanirumand! I created some examples showing the behavior of This feature request and associated PR still stand, though. Should this be made the default behavior of the Here is an example parent POM used as a BOM:
And this is the flatten result when running
Here is the same example parent POM used as a BOM that's been updated with the suggestion from @rezanirumand. I used
And this is the flatten result when running
|
I will see as resolving this issue a new example page in documentation https://www.mojohaus.org/flatten-maven-plugin/ |
When
flattenMode
is set tobom
the plugin keeps theproperties
anddependencyManagement
sections of the POM. But as of version1.5.0
it removes thepluginManagement
section inbom
mode. I believe the behavior ofbom
mode should be changed to keep thepluginManagement
section as well, since it is very similar todependencyManagement
and serves a very similar purpose. See https://www.baeldung.com/maven-plugin-management#plugin-management.The text was updated successfully, but these errors were encountered: