Maven BuildNumber插件Git SSH

时间:2019-06-21 13:56:19

标签: git maven

我有一个使用buildnumber-maven-plugin的maven项目,并且在将项目从GitLab移至GitHub时更改了git remote,但是现在当我尝试运行mvn clean install时出现错误< / p>

ssh: Could not resolve hostname github.com:lukebrewerton: Name or service not known
fatal: Could not read from remote repository.

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

但是我可以使用命令行和推/拉等方式克隆GH repo,这似乎只是行不通的maven命令。

我的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">
  <modelVersion>4.0.0</modelVersion>

  <groupId>net.socialgamer</groupId>
  <artifactId>pyx</artifactId>
  <version>0.7.1-SNAPSHOT</version>
  <packaging>jar</packaging>

  <name>pyx</name>

  <scm>
    <url>https://github.com/lukebrewerton/cahds</url>
    <connection>scm:git:ssh://git@github.com:lukebrewerton/cahds.git</connection>
    <developerConnection>scm:git:ssh://git@github.com:lukebrewerton/cahds.git</developerConnection>
  </scm>

....
<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>buildnumber-maven-plugin</artifactId>
        <version>1.4</version>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>create</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <doCheck>true</doCheck>
          <doUpdate>true</doUpdate>
          <revisionOnScmFailure>0</revisionOnScmFailure>
          <shortRevisionLength>7</shortRevisionLength>
        </configuration>
      </plugin>

1 个答案:

答案 0 :(得分:1)

我们这里有两个问题:

据我所知,GitHub中的克隆按钮为Maven和Git本身提供了无效的URL。否则,您应该将此文件提交给SCM,我将对其进行研究。