java - Jenkins Maven 使用 GIT 发布

标签 java git maven jenkins ssh

我让 Jenkins 设置了与 Git 的 SSH 连接,使用 SSH 代理并尝试设置一个作业,这将执行 Maven 发布构建。该作业正在执行以下命令

-Dresume=false release:prepare release:perform  
-Dresume=false -DdryRun=true release:prepare

在使用 maven-deploy-plugin 部署期间遇到错误,

[INFO] [INFO] 
[INFO] [INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ uaiContacts ---
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD FAILURE
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 4.151 s
[INFO] [INFO] Finished at: 2015-09-23T11:35:32+01:00
[INFO] [INFO] Final Memory: 27M/265M
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project uaiContacts: Failed to deploy artifacts/metadata: Cannot access git@giturl:repo with type default using the available connector factories: BasicRepositoryConnectorFactory: Cannot access git@giturl:repo using the registered transporter factories: WagonTransporterFactory: java.util.NoSuchElementException
[INFO] [ERROR] role: org.apache.maven.wagon.Wagon
[INFO] [ERROR] roleHint: git@giturl
[INFO] [ERROR] -> [Help 1]
[INFO] [ERROR] 
[INFO] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[INFO] [ERROR] Re-run Maven using the -X switch to enable full debug logging.
[INFO] [ERROR] 
[INFO] [ERROR] For more information about the errors and possible solutions, please read the following articles:
[INFO] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

我不确定为什么它说无法访问以及它如何尝试访问。据我所知,wagon 将使用 ssh,所以应该不会有问题。

我的pom.xml

    <build>
         <extensions>
            <extension>
                <groupId>org.apache.maven.wagon</groupId>
                <artifactId>wagon-ssh</artifactId>
                <version>2.4</version>
            </extension>
         </extensions>
    </build>

    <scm>
        <connection>scm:git:git@giturl:repo</connection>
        <developerConnection>scm:git:git@giturl:repo</developerConnection>
        <url>git@giturl:repo</url>  
        <tag>HEAD</tag>
    </scm>

    <distributionManagement>
      <repository>
        <id>release</id>
        <url>git@giturl:repo</url>
      </repository>
    </distributionManagement>

最佳答案

您正在尝试将已发布的 Artifact 部署到 GIT 存储库。 Artifact 通常通过 HTTP (POST) 的方式部署到中央存储库,例如 Artifactory 或 Nexus,除非您指定其他内容。

如果您想使用 SSH 进行部署,this链接将解释它是如何完成的。

关于java - Jenkins Maven 使用 GIT 发布,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32737596/

相关文章:

java - 如何从 xsd 模式生成 simple-xml java 注释对象

java - 使用 PriorityQueue 时出现 ConcurrentModificationException

git add -p --ignore-submodules?

java - 如何配置tomcat每次都重新部署war?

java - 为什么我无法将类导入到 Eclipse Maven 项目中的 java 文件中?

java - Spring bean定义: ArrayList of String array

java - 多线程中的ExecuteQuery关闭hsqldb数据库连接

Python - Jupyter 无法识别 Unix 命令

eclipse - 如何配置 Eclipse EGit 以使用自定义代理设置?

java - 使用 Java 构建工具