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

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

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

    通过release:prepare/perform释放可以正常工作,只要aggr文件夹在svn存储库(repository/trunk/aggr/parent.pom,...)中具有相同的结构即可。

    现在,当我想使用同一项目但使用svn:externals时,发布插件无法正常工作,说明该comp1:
    Can't release project due to non released dependencies : parent:pom:2.0-SNAPSHOT
    然后,存储库结构类似于
  • 信息库/aggr/trunk/pom.xml
  • 信息库/父/trunk/pom.xml
  • 信息库/app/trunk/pom.xml
  • 仓库/comp1/trunk/pom.xml

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

    为什么基于外部环境的Maven处理模块有所不同,有没有办法解决这个问题?

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

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

    小测试
    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
    

    10-07 13:43
    查看更多