Question

We would like to have a company-wide super POM that would inherit from the usual super POM and from which all our company projects would inherit implicitly. Is this possible?

As of now we have to inherit explicitly from our company-wide super POM. This is not very convenient and error-prone.

Can someone please advise?

Was it helpful?

Solution

There is no best practice for this, of which I'm aware. I know of no command line option to specify a super POM, for example.

The only way I can think of seems even more risk prone and less convenient than specifying a parent explicitly, and I would not recommend it. You could check out the source code for Maven, and replace the super POM in the Maven model with your own, basically making a custom Maven build for your company. Then, you'd have to force all your developers to use the customized Maven version, which is just as inconvenient and risk prone as what you're trying to avoid in my opinion.

My company has a suite of corporate parent POMs, all extending from our own super POM. We've used this structure for years and years without issue.

OTHER TIPS

Maven provide the extension mechanism to extends/override the default behavior of maven. By using extension mechanism, super pom can be overridden.

This answer provide detailed steps.

Use the maven-enforcer-plugin to ensure that it is loaded and other criteria that you may have.

Then configure your nexus server so it has a ruleset to enforce that the parent pom is loaded for anything that is deployed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top