Freitag, 25. Oktober 2013

Maven Release Plugin

For some days i have done some updates of my CI environment and i was surprised that my maven release plugin was not working correctly anymore.

After long search in different mailing list and forums i find something that was close to my problem. My problem was that the maven-release-plugin was not committing the correct tag it was still committing *-SNAPSHOT in the "prepare" goal. Because of this in the "performe" goals it was checking the wright tag but this was having *-SNAPSHOT in the pom.xml and that's the "performe" goals was allways trying to deploy a SNAPSHOT to my nexus release repository.

 During my search i also came across this bug MRELEASE-812 "prepare" does not commit before tagging and therefore deploys snapshot instead of release which is from my understanding exactly my problem.

The solution i found it  in some mailing list of the mave-relese-plugin and unfortunatly I haven't bookmark the link so I can remember  now. Lesson learned for next time ;)

Fortunately i was able to reproduce the error because i have commit the change directly in my git repo. The solution was to add the dependencies for the maven-release-pluing

              <dependencies>
        <dependency>
           <groupId>org.apache.maven.scm</groupId>
           <artifactId>maven-scm-api</artifactId>
           <version>1.8.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.scm</groupId>
            <artifactId>maven-scm-provider-gitexe</artifactId>
            <version>1.8.1</version>
        </dependency>
     </dependencies>


On my system I have git in the version 1.8.2.1 In order to know which version of the maven-scm-api are aviable have a look on maven-repos or directly on scms-overview

You can test it on your own with the test configuration which i have upload on github Before testing on your site you will need to change the property of mypath to a value which exist on your system. It should be an absolute path to where you have cloned the project.
Then commit the pom and just run 

mvn release:prepare -B  release:perform

Depending on what is the configuration of your   maven-release-plugin with the dependencies specified or not it should work or not.

Keine Kommentare:

Kommentar veröffentlichen