Jenkins is installing the most-recently built artifact to the local Maven repository, even when the job is executed with a goal of only clean package
.
This caused an issue when someone accidentally committed an updated version of a shared library without incrementing the version number in the library's POM. Jenkins built the jar, installed it to the local Maven repository, and then (as configured) deployed the artifact to our shared Nexus repository. Nexus quite rightly refuses to accept the new artifact, as it already has a release with the given version number.
Some time later Jenkins builds a project that depends on that library, and uses the copy of the library from its local Maven repository rather than Nexus. Thus the project got built with the wrong version of the code.
It seems there are two possible solutions:
- Stop Jenkins from erroneously installing the .jar to the local
repository
- Prevent the local repository from being used when
building projects that depend on the library
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…