首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >将Maven scm添加到子模块的存储库名称

将Maven scm添加到子模块的存储库名称
EN

Stack Overflow用户
提问于 2016-10-12 15:30:17
回答 1查看 1.1K关注 0票数 2

我有一个java应用程序。它是使用maven构建的,它有父模块和子模块。

当应用程序成功构建时,我需要将提交版本号推送到git。

以下是我的POMs:

父pom.xml

代码语言:javascript
复制
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
..
    <modules>
...
        <module>server</module>
...
    </modules>

...
    <scm>
        <url>http://10.72.0.99:8081//service</url>
        <connection>scm:git:10.72.0.99:8081/projectname/service.git</connection>
        <developerConnection>scm:git:git@10.72.0.99:projectname/service.git</developerConnection>
    </scm>

...
</project>

子服务器/pom.xml

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>aka</artifactId>

.....

<name>SERVER</name>
    <artifactId>server</artifactId>
    <packaging>war</packaging>
....

<profiles>
...
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-scm-plugin</artifactId>
        <version>1.8.1</version>
        <configuration>
            <message>${name.module.server}. ${commitMessage}</message>
            <workingDirectory>/</workingDirectory>
        </configuration>
        <executions>
            <execution>
                <phase>package</phase>
                <goals>
                     <goal>checkin</goal>
                 </goals>
            </execution>
        </executions>
   </plugin>
...
</profiles>

Maven日志

代码语言:javascript
复制
[INFO] Executed tasks
[INFO] 
[INFO] --- maven-scm-plugin:1.8.1:checkin (default) @ server ---
[INFO] Executing: /bin/sh -c cd <dir> && git status --porcelain
[INFO] Working directory: <dir> && git commit --verbose -F /tmp/maven-scm-1190574861.commit -a
[INFO] Working directory: <dir>
[INFO] Executing: /bin/sh -c cd <dir> && git symbolic-ref HEAD
[INFO] Working directory: <dir>
[INFO] Executing: /bin/sh -c cd <dir> && git push git@10.72.0.99:project/service.git/server master:master
[INFO] Working directory: <dir>
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] warning: LF will be replaced by CRLF in server/src/main/resources/buildnumber.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in server/src/main/resources/buildnumber.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in server/src/main/resources/buildnumber.properties.
The file will have its original line endings in your working directory.
GitLab: The project you were looking for could not be found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

为什么maven-scm-plugin会加入git推送git@10.72.0.99:project/service.git/server master:master

当正确的存储库git@10.72.0.99:project/service.git

如何修复此功能?

EN

回答 1

Stack Overflow用户

发布于 2017-06-24 01:28:23

我自己也遇到了这个问题。

在每个pom.xml文件中包含<scm>块,以便它们都指向相同的位置。否则,buildnumber-maven-plugin会将模块视为自己的代码库。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39992880

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档