I'm trying to figure out how to organize many (around 50+) maven2 projects, so that they can deploy into a central nexus repository. When using the mvn deploy
goal, one does need to specify the target in the distributionManagement tag like this:
<distributionManagement>
<repository>
<id>nexus-site</id>
<url>http://central_nexus/server</url>
</repository>
</distributionManagement>
Now, i don't want every single pom.xml (of those 50+) to contain this block over and over again. My first though would be the settings.xml
file, but it seems it is not possible (by design) to define it there.
So, the first question would be, why is that the case ? If it would be possible i could specify it in the settings.xml in the maven2 distribution, which could be distributed to all developers.
The only possible solution i've found was to create an organisation-wide master-pom project, that does contain these settings, and make all other pom.xml depend on this master-pom via <parent>
tag. But this looks kind of strange in multi-module builds:
- master configuration POM (pm)
- Project 1 parent pom (p1 with module 1 and module 2 as modules)
- Project 1 module pom (with pm as parent)
- Project 2 module pom (with pm as parent)
Usually i read in all documentation that the module poms should use the parent pom, not some different one. But after reading the maven website about Inheritance v. Aggregation it is written that it is indeed possible.
One problem i found was with the maven site generation, which does seem to have problems with this setup (modules does not get linked correctly if they have no direct back-reference)
So, is this a valid approach ? Any other, more obvious, simpler solution to the problem ?