4
votes

I have a maven project + 2 modules and I use the maven release plugin in order to release a new version.

Unfortunately the goal

release:perform

does not work, although

release:clean release:prepare

works fine.

I already found the problem but I have no idea how to fix it. This is my maven-release-plugin configuration:

...
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <tagBase>https://path_to_svn_server/ApplicationServer/tags/</tagBase>
                    <workingDirectory>${project.build.directory}/checkout/</workingDirectory>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
...
<scm>
    <url>http://path_to_svn_server/ApplicationServer/trunk/</url>
    <developerConnection>scm:svn:https://path_to_svn_server/ApplicationServer/trunk/</developerConnection>
</scm>
...

The problem:

release:prepare creates the following structure at my SVN repository:

+Branches
-Tags
  -commons-0.0.1
     +branches
     +tags
     -trunk
         commons
         commons.bom
         commons.service

release:perform tries to load from a wrong checkout directory, as you can see at the Maven log output:

--- maven-release-plugin:2.5.2:perform (default-cli) @ commons ---
[INFO] Checking out the project to perform the release ...

[INFO] Executing: cmd.exe /X /C "svn --non-interactive checkout
https://path_to_svn_server/ApplicationServer/tags/commons-0.0.8
path_to_workspace\ApplicationServer\trunk\commons\target\checkout"

[INFO] Working directory:
path_to_workspace\ApplicationServer\trunk\commons\target

[INFO] Executing goals 'deploy'...
[WARNING] Base directory is a file. Using base directory as POM location.

In fact the "correct" path at my disk looks like:

path_to_workspace\ApplicationServer\trunk\commons\target\checkout\trunk\commons

for test purposes I moved the commons project (incl. the modules) one level up and afterwards the new svn structure looks like:

+Branches
-Tags
  -commons-0.0.1
     commons
     commons.bom
     commons.service

This workaround works fine!! Version was deployed successfully to my Archiva Repo. (But it is just a workaround....)

I already tried to change the tagBase path and the workingDirectory path as well but unfortunately it is still not working.

one of my attempts:

<workingDirectory>${project.build.directory}/checkout/trunk 

The result was:

path_to_workspace\ApplicationServer\trunk\commons\target\checkout\trunk\trunk\commons

Please can you help me to fix the problem?? I assume I have to fix the workingDirectory path? But what is the right way in order to fix it? Thank you very much in advance!

EDIT:

If I am not mistaken, the SVN structure, which was created by release:prepare, is not really ok ... Normally the TAG folder does not contain "branches", "tags", "trunk" again.

Perhaps I have to fix the tagbase instead of the workingDirectory?? But how can I fix the SVN structure?? Are there any additional settings which could help me?

1

1 Answers

3
votes

I fixed the "problem".

It is necessary to append the project name to the developerConnection and afterwards the following SVN structure will be created:

+Branches
-Tags
    -commons-0.0.1
         commons
         commons.bom
         commons.service

instead of

+Branches
-Tags
    -commons-0.0.1
    +branches
    +tags
    -trunk
         commons
         commons.bom
         commons.service

In my case (multi-module build) I only had to add the parent project to the developerConnection.

Here is my configuration:

...
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.2</version>
                <configuration>
                    <tagBase>https://path_to_svn_server/ApplicationServer/tags/</tagBase>
                    <workingDirectory>${project.build.directory}/checkout/</workingDirectory>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
...
<scm>
    <url>http://path_to_svn_server/ApplicationServer/trunk/</url>
    <developerConnection>scm:svn:https://path_to_svn_server/ApplicationServer/trunk/commons</developerConnection>
</scm>
...

<distributionManagement>
        <repository>
            <id>archiva.internal</id>
            <name>Internal Release Repository</name>
            <url>http://path_to_archiva_server/repository/internal</url>
        </repository>
</distributionManagement>

mvn command in order to start the whole process:

mvn release:clean release:prepare release:perform

Maybe I could help someone with my post :)