简体   繁体   English

Maven 发布 -> 对等方未通过身份验证

[英]maven release -> peer not authenticated

I'm experimenting a bit with releasing my software (I've never done this before) and so far I've been able to execute mvn release:prepare.我正在尝试发布我的软件(我以前从未这样做过),到目前为止我已经能够执行 mvn release:prepare。 As I'm executing release:perform I get the following error:当我执行 release:perform 时,我收到以下错误:

[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plug
in:2.7:deploy (default-deploy) on project img2stl: Failed to deploy artifacts: C
ould not transfer artifact nl.byterendition:img2stl:jar:0.9 from/to byterenditio
n-releases (https://localhost:443/svn/repo/releases): peer not authenticated ->
[Help 1]

I've set up a local password protected svn repository at localhost:443, so I added the following to my settings.xml in my .m2 folder我已经在 localhost:443 上设置了一个本地密码保护的 svn 存储库,因此我将以下内容添加到我的 .m2 文件夹中的 settings.xml 中

EDITED TO INCLUDE Edwin Buck's answer:编辑包括埃德温巴克的回答:

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <servers>
        <server>
            <id>byterendition-releases</id>
            <username>username</username>
            <password>password</password>
        </server>
        <server>
            <id>byterendition-snapshots</id>
            <username>username</username>
            <password>password</password>
        </server>
    </servers>
</settings>

This is the useful section of my pom:这是我的 pom 的有用部分:

<distributionManagement>
    <repository>
        <id>byterendition-releases</id>
        <url>https://localhost:443/svn/repo/releases</url>
    </repository>
    <snapshotRepository>
        <id>byterendition-snapshots</id>
        <url>https://localhost:443/svn/repo/snapshots</url>
    </snapshotRepository>
</distributionManagement>

How can I get maven to access the svn repository?如何让 maven 访问 svn 存储库?

Ok, as Edwin Buck suggested I shouldn't use localhost, but since I haven't been able to get it to work otherwise I thought I'd try this using a remote SVN server I use for work.好的,正如 Edwin Buck 建议我不应该使用 localhost,但由于我无法让它工作,否则我想我会尝试使用我用于工作的远程 SVN 服务器。 Now I get a different error:现在我得到一个不同的错误:

[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plug
in:2.7:deploy (default-deploy) on project img2stl: Failed to deploy artifacts: C
ould not transfer artifact nl.byterendition:img2stl:jar:0.9.5 from/to byterendit
ion-releases (https://svn.science.ru.nl/repos/estens/releases/): Failed to trans
fer file: https://svn.science.ru.nl/repos/estens/releases/nl/byterendition/img2s
tl/0.9.5/img2stl-0.9.5.jar. Return code is: 409, ReasonPhrase: Conflict. -> [Hel
p 1]

Again I can access this repo from Eclipse.我再次可以从 Eclipse 访问这个 repo。 Does anyone know what I'm doing wrong?有谁知道我做错了什么?

Since version 3.0.5 Maven checks the SSL certificate on https connections.从 3.0.5 版开始,Maven 会检查 https 连接上的 SSL 证书。 You can temporarily fix this by adding the command line parameters您可以通过添加命令行参数来临时解决此问题

-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true

Installing the SSL certificate into your JRE should permanently fix the issue.将 SSL 证书安装到 JRE 中应该可以永久解决该问题。

Official documentation: http://maven.apache.org/wagon/wagon-providers/wagon-http/官方文档: http : //maven.apache.org/wagon/wagon-providers/wagon-http/

Step 1. Download the certificate in DER format *.cer (/X.509 .cert) file to your local dir步骤 1.将 DER 格式的证书 *.cer (/X.509 .cert) 文件下载到您的本地目录

(You can do this from your browser; For Chrome Click on the Lock symbol, Show Ceritficate --> Copy to File) (您可以从浏览器执行此操作;对于 Chrome,单击锁定符号,显示证书 --> 复制到文件)

Step 2. Import it to Java trust store步骤 2. 将其导入 Java 信任存储

\\Program_Files\\Java\\jdk1.6.0_45\\jre\\lib\\security>%JAVA_HOME%\\jre\\bin\\keytool -v -alias mavensrv -import -file d:\\temp\\apacher.cer -keystore trust.jks \\Program_Files\\Java\\jdk1.6.0_45\\jre\\lib\\security>%JAVA_HOME%\\jre\\bin\\keytool -v -alias mavensrv -import -file d:\\temp\\apacher.cer -keystore trust.jks

Step 3. Give the path to maven as environment variables步骤 3.将 maven 的路径作为环境变量

set MAVEN_OPTS=-Xmx512m -Djavax.net.ssl.trustStore=%JAVA_HOME%/jre/lib/security/trust.jks -Djavax.net.ssl.trustStorePassword=changeit -Djavax.net.ssl.keyStore=%JAVA_HOME%/jre/lib/security/trust.jks -Djavax.net.ssl.keyStoreType=jks -Djavax.net.ssl.keyStorePassword=changeit set MAVEN_OPTS=-Xmx512m -Djavax.net.ssl.trustStore=%JAVA_HOME%/jre/lib/security/trust.jks -Djavax.net.ssl.trustStorePassword=changeit -Djavax.net.ssl.keyStore=%JAVA_HOME%/ jre/lib/security/trust.jks -Djavax.net.ssl.keyStoreType=jks -Djavax.net.ssl.keyStorePassword=changeit

Your entry in settings.xml is for a server id of localhost but you are accessing repositories with id(s) of byterendition-releases and byterendition-snapshots .您在settings.xml条目用于localhost的服务器 ID,但您正在访问具有byterendition-releasesbyterendition-snapshots id(s) 的存储库。

This means that maven won't recogonize and associate the credentials with these two servers, because they have different "identities".这意味着 maven 不会识别和关联这两个服务器的凭据,因为它们具有不同的“身份”。 You will need settings.xml entries for byterendition-releases and byterendition-snapshots .您将需要用于byterendition-releasesbyterendition-snapshots settings.xml 条目。

Now if you added an entry like现在,如果您添加了一个条目,例如

    <server>
        <id>byterendition-releases</id>
        <username>user</username>
        <password>password</password>
    </server>

Then maven would meet the https authentication challenge to byterendition-releases with a username of user and a password of password , because it has a server credential entry for byterendition-releases .然后 maven 将使用用户名user和密码password来满足对byterendition-releases的 https 身份验证质询,因为它有一个用于byterendition-releases的服务器凭据条目。

You'll also have to add in an additional entry for byterendition-snapshots , or set it to have the same server id as byterendition-releases .您还必须为byterendition-snapshots添加一个附加条目,或将其设置为与byterendition-releases具有相同的服务器 ID。

--- Edited to keep up with the updated question --- --- 编辑以跟上更新的问题---

You are reaching for your repository with a localhost URL.您正在使用localhost URL 访问您的存储库。 While this might work if your repository is really on the same host machine, there are lots of reasons why it might not work.如果您的存储库确实在同一台主机上,这可能会起作用,但它可能不起作用的原因有很多。

  1. The SVN repository is on a remote SVN server, so this will fail when developing elsewhere than the remote server. SVN 存储库位于远程 SVN 服务器上,因此在远程服务器以外的其他地方进行开发时会失败。
  2. The HTTP server is not configured to resolve localhost exactly the same way that it might resolve an external request. HTTP 服务器未配置为解析 localhost 的方式与解析外部请求的方式完全相同。

Either way, ditch localhost.无论哪种方式,放弃本地主机。 If you can't get a stable DNS name for the machine, even putting in an IP address is a better choice.如果您无法为机器获得稳定的 DNS 名称,那么即使输入 IP 地址也是更好的选择。 If your SVN server is on DHCP, then invest the time into getting DynamicDNS working (but really, you should get a static IP for a server if you can).如果您的 SVN 服务器使用 DHCP,那么请花时间让 DynamicDNS 工作(但实际上,如果可以,您应该为服务器获取静态 IP)。

https://github.com/escline/InstallCert提供了必要的工具,并提供了有关如何将远程证书导入系统范围的证书存储的分步说明。

I found that the Java version can make a difference here.我发现 Java 版本可以在这里有所作为。

With Maven 3.0.5 I was getting this error with Java 6, but switching to Java 7 (or newer) resolved it for me.在 Maven 3.0.5 中,我在 Java 6 中遇到了这个错误,但切换到 Java 7(或更新版本)为我解决了这个问题。

It looks like a SSL problem when connecting to the server.连接到服务器时看起来像是 SSL 问题。 Maybe before the username and password check.也许在用户名和密码检查之前。

Did you config the svn server with SSL client auth?您是否使用 SSL 客户端身份验证配置了 svn 服务器? This means you need to send a client certificate to the server.这意味着您需要将客户端证书发送到服务器。

I've had lot of security issues after upgrading to OSX Mavericks升级到 OSX Mavericks 后,我遇到了很多安全问题

  • SSL problem with Amazon AWS亚马逊 AWS 的 SSL 问题
  • peer not authenticated with Maven and Eclipse对等点未通过 Maven 和 Eclipse 进行身份验证
  • trustAnchors parameter must be non-empty trustAnchors 参数必须非空

I applied this JAVA update and it fixed all my issues: http://support.apple.com/kb/DL1572?viewlocale=en_US我应用了这个 JAVA 更新,它解决了我所有的问题: http : //support.apple.com/kb/DL1572?viewlocale=en_US

I'm using maven 3.5.3, and I choose to temporarily fix this SSL issue by adding the command line parameters according to above answers.我正在使用 maven 3.5.3,我选择通过根据上述答案添加命令行参数来临时解决此 SSL 问题。 But the parameters's format seems changed a little.但是参数的格式似乎发生了一些变化。

-D maven.wagon.http.ssl.insecure=true -D maven.wagon.http.ssl.allowall=true

Sorry I can't comment @Alex Punnen's answer, so I have to write a new answer.抱歉,我无法评论@Alex Punnen 的回答,所以我必须写一个新的答案。

I had the same issue using maven 3.6.0.我在使用 maven 3.6.0 时遇到了同样的问题。 All proposed solutions (using -Dmaven.wagon.http.ssl.insecure=true , -Dmaven.wagon.http.ssl.allowall=true , update CA store) did not work for me.所有建议的解决方案(使用-Dmaven.wagon.http.ssl.insecure=true-Dmaven.wagon.http.ssl.allowall=true ,更新 CA 存储)对我不起作用。 Actually the deployment failed not on the first module but on the ~25ish or so, and was successful for all previous modules.实际上,部署失败不是在第一个模块上,而是在 ~25 左右,并且对于之前的所有模块都成功。 Thus I assumed that in general the SSL handling was ok and there was general issue in the local <> server connection or certificates.因此,我认为一般来说 SSL 处理没问题,并且本地 <> 服务器连接或证书存在一般问题。

Leaving me quite confused for some time, I today stumbled across this jacoco issue where they mention the deployAtEnd parameter .让我困惑了一段时间,今天我偶然发现了这个 jacoco 问题,他们提到deployAtEnd参数 Adding this parameter to my pom.xml as part of the deploy plugin configuration solved the issue for me.将此参数添加到我的 pom.xml 作为部署插件配置的一部分为我解决了这个问题。

However, I'm yet not clear on why the deployment failed on some later module and not on the first already.但是,我还不清楚为什么在稍后的模块上部署失败,而不是在第一个模块上部署失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM