the corner office : tech blog

a tech blog, by Colin Pretorius

Maven. Git. Pain.

Man. Untold pain with Maven 3.0.4 and the maven release plugin with git. I haven't touched this stuff in over a year, using 2.something, and perhaps it didn't work properly then, either.

The biggest headache is that I want clean release versions, but I don't want to hard-code servers and paths into my poms. If I ever push the code to a public repo it's just noise, and my home set-up changes often enough, besides.

So, to get mvn release:prepare working with the local git repo, I did the following:

In the pom, I added:

<scm>
    <connection>scm:git:file://.</connection>
</scm>

and in the plugins section:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-release-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <pushChanges>false</pushChanges>
        <localCheckout>true</localCheckout>
    </configuration>
</plugin>

Then because I don't have a distributionManagement element, mvn release:perform falls over. I could fiddle with the deploy goals, but I do have a 'private' (not local) repo where I keep my release builds. The trick is getting the altDeploymentRepository argument passed to the forked maven process:

mvn -B release:perform -Darguments="-DaltDeploymentRepository=id::default::file:///path/to/my/repo/"

(the -B hides the progress output when downloading)

{2012.07.28 22:35}

« Links 2012.07.28

» Apple v Samsung