我让 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>
您正在尝试将已发布的工件部署到 GIT 存储库。工件通常通过 HTTP (POST) 的方式部署到中央存储库,例如 Artifactory 或 Nexus,除非您指定其他内容。
如果您想使用 SSH 进行部署,这个链接将解释它是如何完成的。
我们正在从 SVN 迁移到 BitBucket,我的建议是不要在 git 中使用 maven-release 插件。