Maven Release Plugin with Svn:Externals and a mult

2020-07-10 09:35发布

问题:

Given the following sample multi-module project:

  • aggr/pom.xml (Version 1.0-SNAPSHOT)
  • aggr/parent/pom.xml (Version 2.0-SNAPSHOT)
  • aggr/app/pom.xml (Version 3.0-SNAPSHOT)
  • aggr/comp1/pom.xml (Version 4.0-SNAPSHOT)

where parent is the parent of any other pom and app has a dependency of comp1.

Releasing via release:prepare/perform just works fine as long as the aggr folder has the same structure within the svn repository (repository/trunk/aggr/parent.pom, ...).

Now when I want to use the same project but with svn:externals, the release-plugin doesn't work stating that comp1:

Can't release project due to non released dependencies : parent:pom:2.0-SNAPSHOT

The repository structure is then something like

  • repository/aggr/trunk/pom.xml
  • repository/parent/trunk/pom.xml
  • repository/app/trunk/pom.xml
  • repository/comp1/trunk/pom.xml

the aggr folder uses externals pointing to the module-trunks and therefore the checked out working copy looks like the above.

Why is Maven handling modules based on externals differently and is there a way to overcome this?

Edit: The pom-Files of the svn:externals Project. The only difference to the pom-Files of the other project are the scm tags. In the other non-externals project only the aggregator has the scm tag.

External parent-pom.xml

<groupId>small.test</groupId>
<artifactId>parent</artifactId>
<version>2.0-SNAPSHOT</version>

<scm>
    <connection>scm:svn:http://localhost/svn/small-test-ext/parent/trunk/</connection>
    <developerConnection>scm:svn:http://localhost/svn/small-test-ext/parent/trunk/</developerConnection>
    <url>http://localhost/svn/small-test-ext/parent/trunk/</url>
</scm>

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.4.1</version>
    </plugin>
</plugins>

External aggr-pom.xml small.test parent 2.0-SNAPSHOT

<groupId>small.test</groupId>
<artifactId>aggr</artifactId>
<version>1.0-SNAPSHOT</version>

<scm>
    <connection>scm:svn:http://localhost/svn/small-test-ext/aggr/trunk/</connection>
    <developerConnection>scm:svn:http://localhost/svn/small-test-ext/aggr/trunk/</developerConnection>
    <url>http://localhost/svn/small-test-ext/aggr/trunk/</url>
</scm>

<modules>
    <module>parent</module>
    <module>comp1</module>
    <module>comp2</module>
    <module>app</module>
</modules>

External app-pom.xml

<parent>
    <groupId>small.test</groupId>
    <artifactId>parent</artifactId>
    <version>2.0-SNAPSHOT</version>
</parent>
<groupId>small.test</groupId>
<version>3.0-SNAPSHOT</version>

<artifactId>app</artifactId>
<packaging>jar</packaging>

<scm>
    <connection>scm:svn:http://localhost/svn/small-test-ext/app/trunk/</connection>
    <developerConnection>scm:svn:http://localhost/svn/small-test-ext/app/trunk/</developerConnection>
    <url>http://localhost/svn/small-test-ext/app/trunk/</url>
</scm>

<dependencies>  
    <dependency>
    <groupId>small.test</groupId>
    <artifactId>comp1</artifactId>
    <version>4.0-SNAPSHOT</version>
</dependency>

Thanks Konrad

回答1:

In your current project you must run mvn:release for each one, cause you have projects or modules in different svn repositories. If you want to run just one mvn:release your repository should looks like:

svn_repository: branches/
            tags/
            trunk/
                  parent
                  comp1
                  comp2
                  app
                  pom.xml