带有Svn:Externals和一个多模块项目的Maven版本插件 [英] Maven Release Plugin with Svn:Externals and a multi-module project

查看:199
本文介绍了带有Svn:Externals和一个多模块项目的Maven版本插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出以下示例多模块项目:

Given the following sample multi-module project:

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

其中parent是任何其他pom的父级,而应用具有comp1的依赖项.

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

通过release发布:准备/执行正常工作,只要aggr文件夹在svn存储库(repository/trunk/aggr/parent.pom,...)中具有相同的结构即可.

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, ...).

现在,当我想使用同一项目但使用svn:externals时,发布插件无法正常工作,说明该comp1:

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

存储库的结构类似于

  • 存储库/aggr/trunk/pom.xml
  • 存储库/父/主干/pom.xml
  • 存储库/app/trunk/pom.xml
  • 存储库/comp1/trunk/pom.xml

aggr文件夹使用指向模块主干的外部组件,因此检出的工作副本类似于上面.

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

为什么Maven在基于外部的处理模块方面有所不同,并且有一种方法可以克服这一点?

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

svn:externals项目的pom文件.与其他项目的pom-Files唯一的区别是scm标记.在其他非外部项目中,仅聚合器具有scm标记.

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.

外部parent-pom.xml

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>

外部aggr-pom.xml 小测试 父母 2.0快照

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>

外部app-pom.xml

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>

谢谢 康拉德

推荐答案

在当前项目中,您必须为每个项目运行mvn:release,因为您的项目或模块位于不同的svn存储库中.如果您只想运行一个mvn:release,则您的存储库应如下所示:

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

这篇关于带有Svn:Externals和一个多模块项目的Maven版本插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆