简体   繁体   English

带有Svn的Maven Release Plugin:Externals和一个多模块项目

[英]Maven Release Plugin with Svn:Externals and a multi-module project

Given the following sample multi-module project: 给出以下示例多模块项目:

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

where parent is the parent of any other pom and app has a dependency of comp1. 其中parent是任何其他pom的父级,app具有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, ...). 通过发布释放:只要aggr文件夹在svn存储库(repository / trunk / aggr / parent.pom,...)中具有相同的结构,prepare / perform 就可以正常工作

Now when I want to use the same project but with svn:externals, the release-plugin doesn't work stating that comp1: 现在,当我想使用相同的项目,但使用svn:externals时,release-plugin无法说明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 库/汇聚/主干/ pom.xml的
  • repository/parent/trunk/pom.xml 库/父母/主干/ pom.xml的
  • repository/app/trunk/pom.xml 库/应用/主干/ pom.xml的
  • repository/comp1/trunk/pom.xml 库/ COMP1 /主干/ pom.xml的

the aggr folder uses externals pointing to the module-trunks and therefore the checked out working copy looks like the above. aggr文件夹使用指向模块中继的外部,因此签出的工作副本如上所示。

Why is Maven handling modules based on externals differently and is there a way to overcome this? 为什么Maven以不同的方式处理基于外部的模块,有没有办法克服这个问题?

Edit: The pom-Files of the svn:externals Project. 编辑:svn:externals项目的pom-Files。 The only difference to the pom-Files of the other project are the scm tags. 与其他项目的pom-Files的唯一区别是scm标记。 In the other non-externals project only the aggregator has the scm tag. 在其他非外部项目中,只有聚合器具有scm标记。

External parent-pom.xml 外部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 外部aggr-pom.xml small.test父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 外部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 谢谢康拉德

In your current project you must run mvn:release for each one, cause you have projects or modules in different svn repositories. 在当前项目中,您必须为每个项目运行mvn:release ,因为您在不同的svn存储库中有项目或模块。 If you want to run just one mvn:release your repository should looks like: 如果你想只运行一个mvn:release你的存储库应该是这样的:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM