4
votes

Versions : maven 3.0.4 , release plugin 2.4.0

The goal is to release multiple features (projects) in one step using the maven release plugin, and in a non interactive way. I use : http://maven.apache.org/maven-release/maven-release-plugin/examples/non-interactive-release.html

Svn structure :

http://host/svn/feature1/trunk | tags | branches
http://host/svn/feature2/trunk | tags | branches
http://host/svn/feature3/trunk | tags | branches

Each feature have a pom.xml, with a specific version name, and scm url section.

With this structure, I wish to release all the features in one step (there is more than 12 features, and dependencies between them...). I was thinking that maven reactor plugin may help me a lot, to deploy and release all in the right order ;-) Then I create a "build / assembly" project branch in svn, with the following svn externals :

feature1 http://host/svn/feature1/trunk
feature2 http://host/svn/feature2/trunk
...

The goal using svn externals, is to have a flat workspace (it avoid issues with maven release plugin...). In this build project I have only one pom.xml, multi project aggregator of all the features.

<modules>
    <module>feature1</module>
    <module>feature2</module>
    <module>feature3</module>
    ...
</modules>

Then I use maven release command :

mvn -B release:clean release:prepare release:perform

with the following release.properties

project.rel.org.sample.test\:feature1=1.0.0-RC1
project.dev.org.sample.test\:feature1=1.0.0-RC2-SNAPSHOT
project.scm.org.sample.test\:feature1.developerConnection=scm\:svn\:http\://host/svn/feature1/trunk
project.scm.org.sample.test\:feature1.connection=scm\:svn\:http\://host/svn/feature1/trunk

project.rel.org.sample.test\:feature2=1.0.0-RC1
project.dev.org.sample.test\:feature2=1.0.0-RC2-SNAPSHOT
...

With this file, and the -B argument, there is no need of an interactive input, asking features version to user. So, the job could be launch using jenkins :D...

At this step :

  • scm commited changes are ok (scm url and version)
  • the artifacts are well deployed
  • But the features scm tags are not created in svn...

Only the scm tag of the root build / assembly project have been performed...

[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Reactor Summary:
[INFO] [INFO]
[INFO] [INFO] build ..................................... SUCCESS [1.104s]
[INFO] [INFO] feature1 .................................. SUCCESS [0.187s]
[INFO] [INFO] feature2 .................................. SUCCESS [0.648s]
[INFO] [INFO] feature3 .................................. SUCCESS [0.370s]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 2.552s
[INFO] [INFO] Finished at: Thu Jan 03 14:45:37 CET 2013
[INFO] [INFO] Final Memory: 9M/22M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] Cleaning up after release...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] build ............................................. SUCCESS [7.201s]
[INFO] feature1 .......................................... SKIPPED
[INFO] feature2 .......................................... SKIPPED
[INFO] feature3 .......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

The SKIPPED status for features seems strange in the summary (but it is SUCCESS for commiting and cleaning phases)

The problem is not really easy to explain, I hope to be clear...

Do anybody have met the same problem ? Some tricks / information to solve this problem ?

1

1 Answers

2
votes

The first thing which gets into my mind is using externals in SVN like this:

feature1 http://host/svn/feature1/trunk
feature2 http://host/svn/feature2/trunk
...

will produce a state which is not reproducible at all, cause the trunk will change in the future so you can't recreate this exact state. Furthermore that maven-release-plugin will make only a tag for the root part (aggegration pom) is correct. On the other hand absolute URL's should be prevented using in the relationship with externals.

Apart from the above it sounds like you are using SVN as a dependency management tool which is not its purpose, cause Maven is designed for such things and in particular if you have relationships between those features which sounds like not features it sounds more like modules instead of features. The result of that is that you should change your structure:

  +-- root (pom.xml with modules list)
       +--- module-1 (pom.xml)
       +--- module-2 (pom.xml)
       +--- module-3 (pom.xml)
       +--- module-4 (pom.xml)
       ...

and in SVN you have to put the root folder into the trunk of a project and define only a single scm ara in the root pom.xml file. This is called a multi-module build which handles things like dependencies between the modules and will order the reactor into the correct order.