Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven release plugin - SNAPSHOT project needed

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 ?

like image 775
Pulak Agrawal Avatar asked Nov 22 '12 13:11

Pulak Agrawal


Video Answer


1 Answers

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.

like image 148
Marquee Avatar answered Sep 19 '22 13:09

Marquee