你如何让Maven接受无效的SSL证书?

时间:2014-08-15 00:30:57

标签: java security maven ssl

我的公司将Maven依赖项保留在具有无效SSL证书的服务器上。我们必须使用https进行连接。当我尝试运行Maven时,它无法下载资源。

我知道我想去的网站的名称。我很乐意为网站添加安全例外,或者只是关闭ssl证书的所有验证,以便所有https网站都被视为有效。

我正在使用Maven 3.0.4。

以下是我尝试构建时堆栈跟踪的一些要点:

Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact
org.apache.maven:maven-plugin-api:pom:2.0.6 from/to NexusExternal (<code>https</code>:
//mydumbcompanysbrokensite:8443/nexus/content/groups/public): 
sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification
path to requested target

...

Caused by: org.apache.maven.wagon.TransferFailedException: 
sun.security.validator.ValidatorException: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification 
path to requested target

1 个答案:

答案 0 :(得分:5)

您可以通过将以下选项添加到命令行来禁用Maven SSL验证:

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