maven存储库的证书无效

时间:2014-07-25 14:41:56

标签: spring maven repository

我尝试使用plateform-b​​om的依赖

<dependency>
    <groupId>io.spring.plateform</groupId>
    <artifactId>plateform-bom</artifactId>
    <version>1.0.1-RELEASE</version>
    <type>pom</type>
    scope>import</scope>
</dependency>

所以我添加了Spring的存储库

<repository>
    <id>spring-repo</id>
    <name>Spring Maven Repository</name>
    <url>https://repo.spring.io/release/</url>
 </repository>

但是存储库没有有效的证书,所以maven拒绝使用它。 是否有http而不是https存储库,或者您是否可以在存储库中放置有效的证书? 最好的问候

这是mvn命令的结果:

mobo7205@ubuntu:~/NetBeansProjects/plateform/test/test-frontend$ mvn clean install
[INFO] Scanning for projects...
Downloading: https://maven.springframework.org/release/io/spring/plateform/plateform-bom/1.0.1-RELEASE/plateform-bom-1.0.1-RELEASE.pom
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.orange.test:test-frontend:1.0.0-SNAPSHOT (/home/mobo7205/NetBeansProjects/plateform/test/test-frontend/pom.xml) has 2 errors
[ERROR]     Non-resolvable import POM: Could not transfer artifact io.spring.plateform:plateform-bom:pom:1.0.1-RELEASE from/to spring-repo (https://maven.springframework.org/release): hostname in certificate didn't match: <maven.springframework.org> != <repo.springsource.org> OR <repo.springsource.org> @ com.orange.test:test:1.0.0-SNAPSHOT, /home/mobo7205/NetBeansProjects/plateform/test/pom.xml, line 111, column 25 -> [Help 2]
[ERROR]     'dependencies.dependency.version' for org.springframework:spring-core:jar is missing. @ line 63, column 21
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

3 个答案:

答案 0 :(得分:4)

由于过时的Maven版本,其 HttpComponents 依赖项无法使用SNI SSL证书,因此遇到了此hostname in certificate didn't match问题。

一旦我更新了Maven(可能比Maven 3.2.5更好),一切都运行良好。

答案 1 :(得分:0)

HTTPS是一个双头野兽。一方面,我们真的应该将它用于互联网上的每项服务,特别是在下载代码时(例如,确保代码没有被篡改)。

另一方面,设置HTTPS非常昂贵,很难做到正确,证书年龄和与HTTPS服务器通信的可用库是脆弱的,充满敌意的,并且通常使用起来很乱。

因此,您可以尝试按照these instructions如何在本地计算机上创建密钥存储区。下一个丑陋的任务是从服务器获取证书。某些浏览器支持导出证书。或者您可以使用this tool(当您在代理后面时,它不会起作用:-()。

但是,即使你做了这一切,也有可能因为你得到的错误而无法工作:

  

证书中的主机名没有匹配

这基本上意味着服务器上的HTTPS证书是为不同的服务器创建的。由于这通常是某人试图破解你的连接的绝对信号,因此Java拒绝连接(并且正确地如此)。

不幸的是,许多HTTPS服务器配置不正确(或者他们的域名由不了解他们正在做什么的人改变了)所以你比你应该更频繁地得到这种错误。我甚至没有说过谈论代理服务器。

这意味着您必须通知给您网址的人并告诉他们他们的设置已损坏。然后你等了几个星期,直到他们解决它。

答案 2 :(得分:-1)

甚至在将maven升级到3.2.5之后,您可能会遇到以下关于长耳兔的错误:

[ERROR] The build could not read 1 project -> [Help 1] [ERROR] The project com.adobe.training:company-ui:0.0.1-SNAPSHOT (c:\AEM-Video-Training\company\company-ui\pom.xml) has 1 error
[ERROR] Unresolveable build extension: Plugin com.day.jcr.vault:maven-vault-plugin:0.0.6 or one of its dependencies could not be resolved: Could not find artifact org .apache.jackrabbit:jackrabbit-jcr-commons:jar:2.0-alpha8 in adobe-public-releases (http://repo.adobe.com/nexus/content/groups/public) -> [Help 2]

解决方案:

1) Go to the .m2/repository/org\apache\jackrabbit\jackrabbit-jcr-commons\2.0 alpha8 2) Rename the files to make and remove "lastupdated" from the extension. jackrabbit-jcr-commons-2.0-alpha8.jar jackrabbit-jcr-commons-2.0-alpha8.pom 3) run "mvn clean install -P full" and see Build and deployment successful.