Jenkins Maven - No SNAPSHOT project in the reactor projects list

Sometimes when releasing your projects on Jenkins you will encounter this Maven error message:

You don't have a SNAPSHOT project in the reactor projects list

even if your pom.xml contains proper (x.y-SNAPSHOT) version.

I have seen it few times and the path leading to this problem always looked like this:

  • you try to release a project (using Maven Release Plugin) on Jenkins
  • for some reason the release fails, but Maven had already updated the versions in your pom.xml file(s), and it had also created some temporary files in the workspace directory on the CI server
  • now you update pom.xml file(s) reverting the changes done by Maven i.e. you change non-snapshot versions to snapshot versions
  • after commiting the files (and fixing the original problem whatever it was) you release once again and this time it dies with:
    You don't have a SNAPSHOT project in the reactor projects list

What is going on here? The problem is that the you have your SVN strategy for this job set to "use svn update as much as possible" so the workspace directory is not cleaned and Maven uses the old temporary files which contain some weird versions instead of the current SNAPSHOTs.

Solution

Use different SVN strategy like "always check out a fresh copy" or "Emulates clean checkout..." This will clean these temporary files and Maven will use whatever is in your pom.xml file(s).

Or maybe mvn clean install ?

Or maybe mvn clean install ?

nope

mvn clean install wipes out only target dirs and will not remove temporary files created by maven release plugin

Please comment using