I know that I can import dependencyManagement entries to a POM by using a so-called BOM from the repository. I wonder if there is a similar mechanism to reference a file in the same project.
We are generating POMs in an automated conversion step from Ant to Maven. For reproducibility, we need to generate quite a long dependencyManagement section. I would to be nice to put it into a separate file in the same project.
Is this possible?
No, this is explicitly not supported with Maven 2 and 3. It was asked in MNG-3556, but was closed as "Won't Fix". The reason is that it would allow the creation of POMs that are no longer self-contained. What you can do here, is make a concrete Maven project containing the BOM you're generating, release it, and then import it in other projects with <scope>import</scope>.
But, it migth be done in the future with version 5.0.0 of the POM model. Ideas about it are written on this Confluence page and it does contain the notion of mixins, asked in MNG-5102, which would allow parts of the POM to be included from other sources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With