Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial Maven Release plugin problems

I love using Maven and distributed SCMs like Mercurial (BitBucket).

However as I bring my project to scale and my Hg repository grows, I am finding the Maven Release plugin more and more cumbersome to work with.

The primary problem is that when a mvn release:prepare is called Maven doesn't take advantage of the distributed nature of Hg and performs a full clone of the entire repository to put into a temporary directory.

The issue is very well documented by Fabrizio Giudici back in 2009 http://weblogs.java.net/blog/fabriziogiudici/archive/2009/10/29/fixing-two-problems-maven-mercurial-hudson

I would have thought Sonatype might have updated the plugin by now, but alas we are still having to download the entire repo prior to releasing.

I was hoping to reach out to the StackOverflow community to see if anyone else was experiencing this problem and whether anybody has come up with novel ways of solving the dreaded full clone upon a maven release.

like image 810
alwinc Avatar asked Aug 02 '12 00:08

alwinc


1 Answers

This is what I do to avoid the silly multi push to mercurial with maven:

First make sure you use the correct version of the plugin handling the mercurial type of scm via:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <tagNameFormat>@{project.version}</tagNameFormat>
    </configuration>
</plugin>

then execute first the prepare goal

mvn release:prepare -DautoVersionSubmodules=true -DreleaseVersion=x.x.x -DdevelopmentVersion=y.y.y-SNAPSHOT -DpushChanges=false

note the pushChanges=false attribute

if all ok then
    hg push
    mvn release:perform
else
    mvn release:clean
    and have fun removing the changeset from local hg repo
endif
like image 82
Farid Avatar answered Nov 14 '22 15:11

Farid