I am using the M2 release plugin from within Jenkins which calls the maven-release-plugin 2.3.2 internally and while building throws this error : You don't have a SNAPSHOT project in the reactor projects list
. Problem is , my projects poms do have their version as 1.0.0-SNAPSHOT. What am I missing ?
com.abc.def
is the company parent POM
, and I am just doing for mvn release
for utils
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.abc</groupId>
<artifactId>def</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.abc.def</groupId>
<artifactId>utils</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>utils</name>
And yes, I have done my basic Google + SO trawl and everywhere it points that my POMs should be having SNAPSHOT as the version , which is already there. Except that my company parent POM is not snapshot. Could that be the reason ?
I had the same problem but these solutions didn't work. This blog post by Tomek Kaczanowski hit the nail on the head.
The cause often is that the Jenkins SVN strategy is set to "use svn update as much as possible" which does not clean up the build workspace between builds.
When you try to cut a release, Jenkins will update your pom and create some temporary files. If the release fails, these pom updates and temp files are not cleaned up. So then, when you fix the pom and try to rebuild, you get the You don't have a SNAPSHOT project in the reactor projects list
error due to these funky workspace artifacts confusing Jenkins.
The solution is to change your Jenkins SVN strategy. Any of the following should work:
- always check out a fresh copy
- emulate clean checkout by first deleting unversioned/ignored files, then 'svn update'
- use svn update as much as possible, with 'svn revert' before update
I'd also recommend you clear out your Jenkins workspace just to make sure you're starting fresh.
Master pom
doesn't need to be SNAPSHOT
as well (at my company we have the same setup and it works OK). This part of utils pom
is OK as far as I can tell, so maybe you're missing something else, like
<scm>
<developerConnection>scm:${release-scm}</developerConnection>
</scm>
and of course the maven release plugin
section in build definition in your POM
?
(a long shot I know)
i sometimes found spelling problems with the term: "SNAPSHOT", which basically will also lead to the same error. like:
1. SNAPSOT
2. SNASHOT
3. SHNAPSOT
;-) so it is worth to check this out upfront.
cool for fixing is to use on the parent pom:
versions:set
Actually the Jenkis's workspace contain old non SNAPSHOT versions of some modules. Try to wipout the workspace (=to clean and clear it), then do a release again, he will get the correction versions with the suffix -SNAPSHOT
I found the reason: The latest company Parent POM was not being picked up
- I had
clean
and -U
both in the mvn
argument list. Did not work
- Then I cleaned the
~/.m2
repository. Did not work
What worked is, in Jenkins
- Goto the
Job config
page
- Go to
Build
, click Advanced
- Check the box
Use private Maven repository
- Select
Local to the workspace
. Save
I know this is one of those weird things Maven has a habit of doing for some reason. And as usual the errors are not informative/intuitive enough.