带有 Svn :Externals and a multi-module project 的 Maven 发布插件

标签 maven maven-2 maven-release-plugin

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

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

  • 其中 parent 是任何其他 pom 的父级,并且 app 具有 comp1 的依赖项。

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

    现在,当我想使用同一个项目但使用 svn:externals 时,release-plugin 不起作用,说明 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 文件夹使用指向模块主干的外部对象,因此 check out 的工作副本类似于上面。

    为什么 Maven 以不同的方式处理基于外部的模块,有没有办法克服这个问题?

    编辑:svn:externals 项目的 pom 文件。与其他项目的 pom 文件的唯一区别是 scm 标签。在其他非外部项目中,只有聚合器具有 scm 标签。

    外部父 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

    小测试
    parent
    2.0-快照

    <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
    <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您的存储库应如下所示:

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

    关于带有 Svn :Externals and a multi-module project 的 Maven 发布插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16297499/

    相关文章:

    java - 如何在maven应用程序中使用heroku环境变量绑定(bind)http服务器

    java - 如何在不解压缩所有依赖项的情况下使用 Maven 组装控制台应用程序?

    jenkins - 如何在 Jenkins 中获取已发布的 Maven 版本?

    java - 如何从缓存共享 android gradle 库并从中构建

    java - Neo4j 的 POM 文件中应该包含什么?

    eclipse - 如何将 Tomcat 用作具有 Maven 测试范围的 Eclipse 服务器

    java - 从 Maven 项目发布测试工具

    java - maven ${user.home} 没有被正确解析

    maven-2 - 如何处理多模块项目中的 Maven 版本?

    具有单个公开 Artifact 和内部依赖项的 Maven 结构