Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doing Releases with Maven/Hudson/Mercurial

I am attempting to do a release via the Maven release plugin and am having issues with the SCM config. I am using Eclipse with m2eclipse installed. We use Mercurial and on my machine (Win7) I have TortoiseHg installed. I have a test project that creates a jar. We make use of a super pom for our projects, so the test project pom does as well. I have set up this in the super pom:

<build>
    <plugins>
        ....
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-scm-plugin
            <version>1.6</version>
            <configuration>
                <connectionType>connection</connectionType>
            </configuration>
        </plugin>
    </plugins>
</build>

My test project pom looks like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
        http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>my.group</groupId>
    <artifactId>TestJar
    <version>1.0-SNAPSHOT</version>
    <parent>       
        <groupId>my.group</groupId>
        <artifactId>super-pom</artifactId>
        <version>1.0</version>
    </parent>
    <scm>
        <connection>
            scm:hg:ssh://our.scm.server:22//path/to/TestJarProject
        </connection>
        <developerConnection>
            scm:hg:ssh://our.scm.server:22//path/to/TestJarProject
        </developerConnection>
    </scm>
</project>

Note that we ssh to our SCM server. I suspect some of the issues I'm encountering my be related to this. I've only been able to find examples that use http.

In my settings.xml file, I added this:

<servers>
    ...
    <server>
        <id>our.scm.server</id>
        <username>username</username>
        <password>password</password>
    </server>
</servers>

When I run release:prepare release:perform, a TortoisePlink dialog pops up prompting me for a password. The dialog box is asking of "@our.scm.server's password".

It appears it is not using the username or password from the settings.xml file which is what I was expecting by adding the server element to it. Should it be? I have also tried adding my username to the connection url:

<connection>
    scm:hg:ssh://[email protected]:22//path/to/TestJarProject
</connection>

but am still prompted for an empty username's password.

QUESTION ONE

Has anyone successfully used ssh to connect to Mercurial while doing Maven releases?

Since I ultimately want to do the builds in Hudson, I set up a Hudson job to do the release but it fails with this error:

[INFO] o.h.m.e.h.MavenExecutionResultHandler - Build failed with exception(s)
[INFO] o.h.m.e.h.MavenExecutionResultHandler - [1] org.apache.maven.lifecycle.\
   LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:\
   maven-release-plugin:2.0:prepare (default-cli) on project TestJar: Cannot \
   prepare the release because you have local modifications : 
[.maven/repo/ca/shaw/eng/nms/nms-super-pom/1.0/_maven.repositories:unknown]
[.maven/repo/ca/shaw/eng/nms/nms-super-pom/1.0/nms-super-pom-1.0.pom:unknown]
[.maven/repo/ca/shaw/eng/nms/nms-super-pom/1.0/nms-super-pom-1.0.pom.sha1:unknown]
... many, many more lines of this nature .....

QUESTION TWO

What local modifications is Maven encountering?

Since the project is being pulled from the repo, the only change I can think of is the update to the pom file (removing SNAPSHOT from the version). But Maven shouldn't be complaining about this since it made the change itself, no?

UPDATE

As per khmarbaise's suggestion, I've added this to my parent POM:

<pluginManagement>
    <plugins>
        <plugin>
            <artifactId>maven-release-plugin</artifactId>
            <version>2.2.2</version>
        </plugin>
    </plugins>
</pluginManagement>
like image 956
sdoca Avatar asked Nov 04 '22 07:11

sdoca


1 Answers

QUESTION ONE

Has anyone successfully used ssh to connect to Mercurial while doing Maven releases?

The answer appears to be that the Maven Release Plugin only works with https. We were able to get https working on our Mercurial server by generally following the instructions on this page:

https://www.mercurial-scm.org/wiki/HgWebDirStepByStep

QUESTION TWO

What local modifications is Maven encountering?

The local modifications are the .maven directory that is created during the build. By adding .maven/* to my .hgignore file, I was able to complete the build.

like image 94
sdoca Avatar answered Nov 07 '22 21:11

sdoca