簡體   English   中英

Maven SCM添加到子模塊的存儲庫名稱

[英]Maven scm add to repository name of submodule

我有一個Java應用程序。 它使用maven構建,並且具有父模塊和子模塊。

當應用程序成功構建時,我需要將提交發布號推送到git。

這是我的POM:

父pom.xml

<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

<?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日志

[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 push git@10.72.0.99:project/service.git/server master:master

當正確的存儲庫git@10.72.0.99:project/service.git

如何修復此功能?

我只是碰到這個自己。

在每個pom.xml文件中包含<scm>塊,以便它們都指向同一位置。 否則, buildnumber-maven-plugin會將模塊視為其自己的存儲庫。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM