flatten-maven-plugin
flatten-maven-plugin copied to clipboard
Lost package property when use inherited=true
Parent module:
<groupId>tech.simter</groupId>
<artifactId>simter-kv-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<build>
...
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}</outputDirectory>
<flattenedPomFilename>flattened-pom.xml</flattenedPomFilename>
<updatePomFile>true</updatePomFile>
<flattenMode>clean</flattenMode>
<pomElements>
<parent>resolve</parent>
<properties>interpolate</properties>
<dependencyManagement>keep</dependencyManagement>
<dependencies>keep</dependencies>
<pluginManagement>keep</pluginManagement>
<name>resolve</name>
<description>resolve</description>
<profiles>remove</profiles>
</pomElements>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Childmodule:
<parent>
<groupId>tech.simter</groupId>
<artifactId>simter-kv-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>simter-kv-data</artifactId>
<packaging>jar</packaging>
After mvn install
the child module, the flattened-pom.xml
is:
<parent>
<groupId>tech.simter</groupId>
<artifactId>simter-kv-parent</artifactId>
<version>0.2.0-SNAPSHOT</version>
<relativePath>../simter-kv-parent</relativePath>
</parent>
<groupId>tech.simter</groupId>
<artifactId>simter-kv-data</artifactId>
<version>0.2.0-SNAPSHOT</version>
It losts packaging
property.
You know that omitting the packaging mean jar
? So usually can omit the <packaging>..</packaging>
tag if you like to have jar
packaging which is the default...
Yes, I know that. But keep <packaging>..</packaging>
tag is more clear.
When deploy my child module to bintray, bintray recognize it as a pom package if no <packaging>..</packaging>
tag. May be that is bintray bug. But keep it is a good idea.
The behavior comes from org.apache.maven.model.io.xpp3.MavenXpp3Writer (maven-model-3.2.5) which has
if ( ( model.getPackaging() != null ) && !model.getPackaging().equals( "jar" ) )
{
serializer.startTag( NAMESPACE, "packaging" ).text( model.getPackaging() ).endTag( NAMESPACE, "packaging" );
}
so I doubt this has any chance of being changed here.
Considered as nice to have. But no priority. If someone considers this as important please provide a PR.