Hi folks,
I have recently struggled with a very annoying issue of mirror config
and need so idea on a best practice approach.
My setup is fairly simple: I have setup a Nexus instance in our dept and
grouped proxied and hosted (both snap and rel) to a repo "public".
I have created a super pom for our dept, say my.group.id:my-parent which
contains a complete distribution management section for rels and snaps.
I deployed it as snapshot and release to the hosted release repo. It
worked fine.
Meanwhile I altered my settings.xml and set nexus to mirrorOf "*".
It all worked fine when some sub probject used the parent pom as release
version since it was available through the group w/o declaring any repo
explicitly.
Now another project declares the same parent as 1-SNAPSHOT and Maven did
not download the parent pom. This issue drove me crazy since I was
thinking that Nexus is the source of error. I tried again with Maven 3
which told me that my mirror serves releases only (point 6 in [2],
thanks guys for the vastly improved logging). I was pissed because I
spent almost a day for finding this issue.
Obviously, I wanted the my child projects to inherit as much as possible
from my snapshot super pom which is not pullable.
What could be a good practice now? After some digging I found some
solutions/workarounds:
1. Declare a bogus repo with snapshots and releases to enable my mirror
proxy all content as describe in [1].
Well, not very beautiful but universal.
2. Declare the repos in the super pom and let children inherit it.
Won't work since this is a chicked-egg-problem. Can't download a
snapshot pom and enable for snapshots then :-(
3. Declare in each pom every potentionally repo beside Central.
Would be a reasonable solution but way to verbose repeating the
same
information over and over again. This is reasonable for
repos which
aren't under your control, like Spring Source repos.
4. Declare all used hosted repos in the settings.xml in a profile and
activate in by default or with a property in the actual project.
Sounds good but in the actual pom is not obvious where snapshots
and
releases for the same group id will be pulled.
5. File a ticket for extending the mirror element in settings.xml by 2
subelements: releases/enabled and snapshots/enabled. They simply tell
maven that this mirror will handle those type of artifacts by default.
Solves the issue but still suffers from the same as point 4.
None of them satisfy me nor do they represent a sound solution, merely
workarounds. I tend to pick point 1 or 4. Actually 4 because I do retain
some information. Point 1 completely drops every passive documentation
of used repos.
What do you think?
[1]
http://www.sonatype.com/books/nexus-book/reference/maven-sect-single-group.html#ex-maven-nexus-simple
[2]
https://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
--
THANKS
Mit freundlichem Gruß / Best regards
Michael Osipov
Siemens AG
Sector Industry, I DT IT LD Bln (Werkstudent)
mailto:[email protected]