Monday, November 16, 2009

Maven parent snapshot

Another case where Maven just won't listen to me. This time I want to release an artifact which has a snapshot parent dependency.
  <parent>
<groupId>org.jboss.jpa</groupId>
<artifactId>jboss-jpa-build</artifactId>
<relativePath>../build/pom.xml</relativePath>
<version>1.0.1-SNAPSHOT</version>
</parent>

So first of all, why have the snapshot?
Because I want to have continuous integration runs on my Hudson instance.

Now I want to change the snapshot during release to 1.0.1. This is slightly bending the previous requirement where I want CI to happen. The reason is that during the lifetime of this component jboss-jpa-build will continue to evolve, while this component might remain static. So after some time this component will have a dependency on a stale snapshot. (I really want to have [0,) or latest.integration, but that's another story.)
$ mvn -DdryRun=true release:prepare
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'release'.
WAGON_VERSION: 1.0-beta-2
[INFO] ------------------------------------------------------------------------
[INFO] Building JBoss Container Managed JPA Deployers
[INFO] task-segment: [release:prepare] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [release:prepare]
[INFO] Verifying that there are no local modifications...
[INFO] Executing: svn --non-interactive status
[INFO] Working directory: /tmp/deployers
[INFO] Checking dependencies and plugins for snapshots ...
There are still some remaining snapshot dependencies.: Do you want to resolve them now? (yes/no) no: : yes
Dependency type to resolve,: specify the selection number ( 0:All 1:Project Dependencies 2:Plugins 3:Reports 4:Extensions ): (0/1/2/3) 1: : enter
Resolve Project Dependency Snapshots.: 'org.jboss.jpa:jboss-jpa-build' set to release? (yes/no) yes: : enter
What is the next development version? (1.0.2-SNAPSHOT) 1.0.2-SNAPSHOT: : 1.0.1

What is the next development version? (1.0.2-SNAPSHOT) 1.0.2-SNAPSHOT: :
Snif...
Okay, let it ride until the end by specifying the default versions. Now we can change release.properties to match what we want:
dependency.dependency.org.jboss.jpa\:jboss-jpa-build.development=1.0.1

And tell the release plugin to restart:
completedPhase=map-development-versions
Then execute
mvn -DdryRun=true release:prepare
again.

And come to the conclusion that we encounter a bug http://jira.codehaus.org/browse/MRELEASE-449.

No comments:

Post a Comment