从 Eclipse 通过 https 访问本地 Nexus 存储库

Accessing local Nexus repository over https from eclipse

我在我的项目中使用 maven 构建。我在我们的本地网络中有一个公司关系存储库。此存储库通过 https 托管。

我在从 eclipse 访问此存储库时遇到问题。

显示的错误是:

Multiple annotations found at this line:
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (execution: default-compile, phase: compile)
    - CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:2.5.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor 
     for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from https://
     NexusServer/nexus/content/groups/CLM/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced. Original 
     error: Could not transfer artifact org.apache.maven.plugins:maven-compiler-plugin:pom:2.5.1 from/to nexus (https://NexusServer/nexus/content/groups/CLM/): 
     sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    - Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (execution: default-testCompile, phase: test-compile)

我用谷歌搜索了一下,找到了在 运行 maven 构建时通过证书的解决方案。我下载了证书并使用 -Djavax.net.ssl.trustStore=Path/To/My/KeyStore

将其传递给 Maven

命令行工具工作正常。但是,我仍然无法在eclipse中使用maven构建项目。

Maven 不会从本地存储库下载新的依赖项。

在此先感谢您的帮助!

普拉博德

您的 Nexus 使用的 SSL 证书被 Java 运行 Eclipse 认为无效。这是因为 Nexus 中的证书不是由受信任的根证书颁发机构(例如 Verisign)签署的。

您需要将 Nexus 中的 public 证书安装到 Java 运行 Eclipse 的 Java 信任库中以修复此问题,然后它将被信任.您可以使用我们的 import-ssl.jar 实用程序来帮助您,请参阅此处的第 24.2.3 节:

https://books.sonatype.com/nexus-book/reference/ssl-sect-client-cert.html