maven发布插件和多个相互依赖的库(多个gits) - 结构的正确方法是什么?

时间:2014-08-21 11:19:35

标签: git maven maven-release-plugin

我有一组库,每个库都有自己的git存储库,它们是相互依赖的。

我在自动更新版本和以这种方式标记git repo时遇到问题 保持依赖关系。手动执行此操作(编辑26个文件)将非常繁琐,因为有许多库(26)。

是否有一种模式可以解决这个问题(HOWTO)?

这是我失败的解决方案:

目前我有一个父pom,并且认为发布插件可以解决这个问题, 但是这对多个git repos来说似乎有问题。

mvn release:clean release:prepare release:perform -DdevelopmentVersion=1.3-SNAPSHOT -DreleaseVersion=1.2

...

[INFO] Executing: /bin/sh -c cd /home/wayne/Documents && git commit --verbose -F /tmp/maven-scm-967028403.commit pom.xml utils/pom.xml streams/pom.xml
[INFO] Working directory: /home/wayne/Documents
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] parent library .................................... FAILURE [11.694s]
[INFO] utils    .......................................... SKIPPED
[INFO] streams ........................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.015s
[INFO] Finished at: Thu Aug 21 12:49:20 CAT 2014
[INFO] Final Memory: 9M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:prepare (default-cli) on project libparent: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-commit command failed.
[ERROR] Command output:
[ERROR] error: pathspec 'utils/pom.xml' did not match any file(s) known to git.
[ERROR] error: pathspec 'streams/pom.xml' did not match any file(s) known to git.
[ERROR] -> [Help 1]

我的目录结构是这样的:

/home/wayne/Documents/ (libparent module,the root pom is in here ans has a git repo)
/home/wayne/Documents/utils (this is a separate git repo)
/home/wayne/Documents/stream (this is also a separate git repo)

我的POM文件:libparent

<modelVersion>4.0.0</modelVersion>
  <groupId>com.xyz</groupId>
  <artifactId>libparent</artifactId>
  <version>1.1-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>parent library</name>
  <description>A parent pom for all library modules</description>

    <modules>
            <module>utils</module>
            <module>streams</module>
    </modules>

              <scm>
                    <url>https://server.xyz.co.za/repos/code/javacode/libraries/${project.artifactId}</url>
                    <connection>scm:git:ssh://user@server.xyz.co.za/git/javacode/libraries/${project.artifactId}</connection>
                    <developerConnection>scm:git:ssh://user@server.xyz.co.za/git/javacode/libraries/${project.artifactId}</developerConnection>
                    <tag>HEAD</tag>
            </scm>



 <build>

                <pluginManagement>
                <plugins>
                        <plugin>
                                <artifactId>maven-release-plugin</artifactId>
                                <version>2.5</version>
                                 <executions>
                                        <execution>
                                        <id>default</id>
                                        <goals>
                                                <goal>perform</goal>
                                        </goals>

                                        <configuration>
                                        <releaseProfiles>release</releaseProfiles>
                                        <goals>deploy</goals>
                                        <autoversionsubmodules>true</autoversionsubmodules>
                                        <commitByProject>true</commitByProject>
                                        <!--
                                        <pushChanges>false</pushChanges>
                                        -->
                                        <!--
                                        <checkModificationExcludes>
                                                <checkModificationExclude>pom.xml</checkModificationExclude>
                                        </checkModificationExcludes>
                                        -->
                                        <!--    
                                        <dependencies>
                                                <dependency>
                                                        <groupId>org.apache.maven.scm</groupId>
                                                        <artifactId>maven-scm-provider-gitexe</artifactId>
                                                        <version>1.8.1</version>
                                                </dependency>

                                                <dependency>
                                                        <groupId>org.apache.maven.scm</groupId>
                                                        <artifactId>maven-scm-provider-git-commons</artifactId>
                                                        <version>1.8.1</version>
                                                </dependency>       
                                        </dependencies>
                                        -->
                                </configuration>
                                 </execution>
                                 </executions>
                        </plugin>

用于utils库的Pom:

<project ....>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>utils</artifactId>
        <packaging>jar</packaging>

        <parent>
                <groupId>com.xyz</groupId>
                <artifactId>libparent</artifactId>
                <version>1.1-SNAPSHOT</version>
        </parent>


        <scm>
                <url>https://server.xyz.co.za/repos/code/javacode/libraries/${project.artifactId}</url>
                <connection>scm:git:ssh://user@server.xyz.co.za/git/javacode/libraries/${project.artifactId}</connection>
                <developerConnection>scm:git:ssh://user@server.xyz.co.za/git/javacode/libraries/${project.artifactId}</developerConnection>
                <tag>HEAD</tag>
        </scm>
</project>

流媒体库的Pom:

<project ...>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>streams</artifactId>
        <packaging>jar</packaging>

        <parent>
                <groupId>com.xyz</groupId>
                <artifactId>libparent</artifactId>
                <version>1.1-SNAPSHOT</version>
        </parent>

             <scm>
                    <url>https://server.xyz.co.za/repos/code/javacode/libraries/${project.artifactId}</url>
                    <connection>scm:git:ssh://user@server.xyz.co.za/git/javacode/libraries/${project.artifactId}</connection>
                    <developerConnection>scm:git:ssh://user@server.xyz.co.za/git/javacode/libraries/${project.artifactId}</developerConnection>
                    <tag>HEAD</tag>
            </scm>


        <dependencies>

                <dependency>
                        <groupId>com.xyz</groupId>
                        <artifactId>utils</artifactId>
                        <version>1.1-SNAPSHOT</version>
                        <classifier>mobile</classifier>
                        <optional>true</optional>
                </dependency>

        </dependencies>


</project>

0 个答案:

没有答案