Maven scm добавить в хранилище имя субмодуля

У меня есть 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 log

[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-плагин толкает в Git Push git@10.72.0.99:project/service.git/server master:master

когда правильный репозиторий git@10.72.0.99:project/service.git

Как исправить эту функцию?

1 ответ

Я просто столкнулся с этим сам.

Включить <scm> блок в каждом из ваших pom.xml файлы, так что все они указывают на одно и то же место. Иначе, buildnumber-maven-plugin рассматривает модуль как собственный репо.

Другие вопросы по тегам