Eclipse2020.12现在包括一个jvm如何添加公司证书?

56lgkhnf  于 2021-06-26  发布在  Java
关注(0)|答案(1)|浏览(426)

Eclipse2020.12现在在安装中包含了OracleJDK14。如果您的公司有ca(大多数大型公司都有ca),那么这就打破了maven集成。
如何向EclipseJDK添加公司证书?我尝试了以下方法:

find /Applications/Eclipse.app -iname cacerts -exec keytool -importcert -alias emoneyusa-ecdsa -keystore {} -storepass changeit -file ~/Documents/certs/corp-ca.crt -trustcacerts -noprompt \;

但是,我在尝试在eclipse中执行maven函数时仍然遇到这个问题:

org.eclipse.core.runtime.CoreException: Could not resolve artifact xalan:xalan:jar:sources:2.7.2
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$4(MavenImpl.java:804)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:179)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:114)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:101)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:772)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:749)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.download(DownloadSourcesJob.java:330)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.downloadAttachments(DownloadSourcesJob.java:304)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.downloadMaven(DownloadSourcesJob.java:269)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.downloadFilesAndPopulateToUpdate(DownloadSourcesJob.java:233)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.lambda$0(DownloadSourcesJob.java:161)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:179)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:153)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:101)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1374)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.run(DownloadSourcesJob.java:161)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Contains: Failure to transfer xalan:xalan:jar:sources:2.7.2 from https://nexus.xxx.com/repository/xxx-all was cached in the local repository, resolution will not be reattempted until the update interval of xxx-all has elapsed or updates are forced. Original error: Could not transfer artifact xalan:xalan:jar:sources:2.7.2 from/to xxx-all (https://nexus.xxx.com/repository/xxx-all): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
org.eclipse.aether.transfer.ArtifactTransferException: Failure to transfer xalan:xalan:jar:sources:2.7.2 from https://nexus.xxx.com/repository/xxx-all was cached in the local repository, resolution will not be reattempted until the update interval of xxx-all has elapsed or updates are forced. Original error: Could not transfer artifact xalan:xalan:jar:sources:2.7.2 from/to xxx-all (https://nexus.xxx.com/repository/xxx-all): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:225)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:193)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:559)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:483)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:401)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:229)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:207)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:262)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.lambda$4(MavenImpl.java:781)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:179)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:114)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:101)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:772)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.resolve(MavenImpl.java:749)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.download(DownloadSourcesJob.java:330)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.downloadAttachments(DownloadSourcesJob.java:304)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.downloadMaven(DownloadSourcesJob.java:269)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.downloadFilesAndPopulateToUpdate(DownloadSourcesJob.java:233)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.lambda$0(DownloadSourcesJob.java:161)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:179)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:153)
    at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:101)
    at org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(MavenImpl.java:1374)
    at org.eclipse.m2e.jdt.internal.DownloadSourcesJob.run(DownloadSourcesJob.java:161)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

让我印象深刻的是eclipse报告了这个jdk,这很有趣,因为我只安装了OpenJDK11:

eclipse.buildId=4.17.0.I20200902-1800
java.version=14.0.2
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -keyring /Users/xxx/.eclipse_keyring
Command-line arguments:  -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.jee.product -keyring /Users/xxx/.eclipse_keyring
lrl1mhuk

lrl1mhuk1#

很久以前我也遇到过同样的问题,我挣扎了很多,几乎什么都试过了。实际问题是,奇怪的是,1。首先,您的有效证书应该已经安装在jre/jdk中。2.即使您在您使用的jdk中安装了cert,有时它仍然不起作用,因为如果您的机器上安装了多个jre,eclipse会随机选择其中一个jre,并尝试连接到您组织的nexus。现在问题来了。如果eclipse接收到一个没有cert的jre,它将无法连接到repo。解决方案是1。在计算机上的所有JRE中安装证书。2.删除您正在使用并拥有有效证书的其他JRE。在我的团队中,许多团队成员都有这个问题,我们已经用我建议的解决方案解决了。试试这个,如果还有什么问题就告诉我。

相关问题