У меня есть приложение Java. Он построен с использованием maven и имеет родительские и подмодули.
Мне нужно нажать номер фиксации фиксации до git, когда приложение будет успешно создано.
Вот мои POM:
<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:[email protected]:projectname/service.git</developerConnection>
</scm>
...
</project>
<?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>
[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 [email protected]: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 [email protected]:project/service.git/server master:master
когда правый репозиторий [email protected]:project/service.git
Как исправить эту функцию?
Я просто наткнулся на это сам.
Включите блок <scm>
в каждый из ваших файлов pom.xml
чтобы все они указывали на одно и то же место. В противном случае buildnumber-maven-plugin
рассматривает модуль как свое собственное репо.