Usage
Simply add the plugin to the build section of your top-level POM as following.
<build>
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<!--<version>1.7.0</version>-->
<configuration>
</configuration>
<executions>
<!-- enable flattening -->
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<!-- ensure proper cleanup -->
<execution>
<id>flatten.clean</id>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Keep developer information
If you want to keep additional development information in your POM you can configure predefined modes via the flattenMode
parameter.
For typical open-source-projects you can choose "oss". To keep all additional POM elements and flatten only to a bare minimum use "minimum".
Here is an example configuration:
<configuration>
<flattenMode>minimum</flattenMode>
</configuration>