Fork me on GitHub

Flatten Maven Plugin

Flatten Maven Plugin generates a flattened version of your pom.xml and makes maven to install and deploy this one instead of the original pom.xml. The flattened POM has the following characteristics:
  • Build specific elements are removed
  • Development specific elements are removed by default
  • It only contains elements required for users of your artifact
  • Its variables are resolved
  • Its parent relationship is resolved, flattened and removed
  • Its build time driven profiles can be evaluated so their impact gets embedded
  • JDK or OS driven profiles still remain allowing dynamic dependencies if needed
For a complete specification of how the flattened POM is build see here. This allows the following possibilities and features:
  • You can keep the versions of parent POMs fixed and use them for development only distributed via version control only instead of maven repositories. This way you can use centralized variables and dependencyManagement without maintaining and releasing parent POM versions.
  • You can use a lot of the flexibility of maven but avoid various mistakes resulting in installing or deploying POMs that are inconsistent.

Goals

  • flatten:flatten generates the flattened POM and sets it as file of the maven project.
  • flatten:clean removes any files created by flatten:flatten.

Usage

General instructions on how to use the Flatten Maven Plugin can be found on the usage page.

In case you still have questions regarding the plugin's usage, please feel free to contact the user mailing list. The posts to the mailing list are archived and could already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the mail archive.

If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our issue tracker. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. Of course, patches are most welcome too. Contributors can check out the project from our source repository and will find supplementary information in the guide to helping with Maven.