IntelliJ / Maven 回购问题
IntelliJ / Maven repo issue
我真的被这个问题困扰了,这是我尝试修复它的第二天。我尝试了网络上所有可用的资源(至少是我能找到的)
我正在使用 Spring MVC 并尝试启动新的 Maven 项目。发生的事情是项目是从模板构建的,这是我收到的错误。
正在下载:
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.224 s
[INFO] Finished at: 2018-08-28T11:52:04+01:00
[INFO] Final Memory: 7M/30M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Failed to resolve version for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local (C:\Users\pgorski\.m2\repository) -> [Help 1]
[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:
当我在不使用原型的情况下构建新项目时,maven 根本无法工作 - 并出现以下错误:
1:当我检查 Maven 存储库时,我可以看到 repo.aven.apache.org/maven2 错误,其中: java.lang.RuntimeException: java.io.IOException: Transfer for nexus-maven-存储库-index.properties 失败。
2: 当我检查Maven projct 详细信息时,插件和依赖项带有红色下划线。
这是 mvn --debug 的输出:
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:97)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[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/NoGoalSpecifiedException
请帮忙
根据原post评论中提供的答案,我得出结论,贵公司使用代理拦截网络流量。本质上,它会动态地将公司特定的证书添加到您访问的所有 HTTPS 站点的证书路径的顶部。
要在 Java 应用程序中信任您的公司特定证书,您必须将其添加到该应用程序使用的 java 密钥库中。以Intellij IDEA为例,自带JRE,步骤如下:
在浏览器中转到 https://www.google.com 或任何其他 https 站点。单击地址栏左侧的锁定图标,然后按照 UI 获取有关证书路径的信息。在 Chrome 中,您可以在单击锁定图标后单击 "Certificate" 打开的对话框的 "Certification Path" 选项卡中查看此内容。
单击层次结构中最顶层 证书(带有贵公司名称的证书),然后单击查看证书。单击详细信息选项卡,然后单击复制到文件。按照小精灵导出一个.cer Base64编码的文件;我们将其命名为 Company。请注意,这些是 Chrome 特定的说明,但其他浏览器也有类似的步骤。
转到您的 Intellij IDEA 安装文件夹,子文件夹 /jre64/bin(或 /jre32/bin)并在那里复制 Company.cer .
在您复制证书的 bin 文件夹中打开一个 cmd 或 PowerShell(您可以在资源管理器中的空白 space 上右键单击,Windows 上下文菜单将给你一个选择)。 运行 以下命令:
keytool.exe -keystore ..\lib\security\cacerts -importcert -alias Company -file Company.cer
当提示输入密码时,请使用 changeit,这是默认的密钥库密码。当系统提示确认添加公司证书时,还要键入 yes。
重新启动 Intellij IDEA 并重试给出初始错误的操作。
好的 - 现在可以使用了:)
这是解决方案:
基于 Andrei Pietrusel 的指南(非常感谢),我对 Java 的所有安全路径应用了相同的步骤,因此:IntelliJ JRE、Java JRE's/JDK。我重新启动了 IDE 并重新启动了电脑,然后终于成功了!我生命中的 2 天,但他妈的是值得的 :)
再来一次,非常感谢安德烈!
@Edit:我使用 portacle 来管理证书。
我真的被这个问题困扰了,这是我尝试修复它的第二天。我尝试了网络上所有可用的资源(至少是我能找到的)
我正在使用 Spring MVC 并尝试启动新的 Maven 项目。发生的事情是项目是从模板构建的,这是我收到的错误。
正在下载:
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-archetype-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml from/to central (https://repo.maven.apache.org/maven2): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.224 s
[INFO] Finished at: 2018-08-28T11:52:04+01:00
[INFO] Final Memory: 7M/30M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-archetype-plugin:RELEASE or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Failed to resolve version for org.apache.maven.plugins:maven-archetype-plugin:jar:RELEASE: Could not find metadata org.apache.maven.plugins:maven-archetype-plugin/maven-metadata.xml in local (C:\Users\pgorski\.m2\repository) -> [Help 1]
[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:
当我在不使用原型的情况下构建新项目时,maven 根本无法工作 - 并出现以下错误:
1:当我检查 Maven 存储库时,我可以看到 repo.aven.apache.org/maven2 错误,其中: java.lang.RuntimeException: java.io.IOException: Transfer for nexus-maven-存储库-index.properties 失败。
2: 当我检查Maven projct 详细信息时,插件和依赖项带有红色下划线。
这是 mvn --debug 的输出:
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:97)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[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/NoGoalSpecifiedException
请帮忙
根据原post评论中提供的答案,我得出结论,贵公司使用代理拦截网络流量。本质上,它会动态地将公司特定的证书添加到您访问的所有 HTTPS 站点的证书路径的顶部。
要在 Java 应用程序中信任您的公司特定证书,您必须将其添加到该应用程序使用的 java 密钥库中。以Intellij IDEA为例,自带JRE,步骤如下:
在浏览器中转到 https://www.google.com 或任何其他 https 站点。单击地址栏左侧的锁定图标,然后按照 UI 获取有关证书路径的信息。在 Chrome 中,您可以在单击锁定图标后单击 "Certificate" 打开的对话框的 "Certification Path" 选项卡中查看此内容。
单击层次结构中最顶层 证书(带有贵公司名称的证书),然后单击查看证书。单击详细信息选项卡,然后单击复制到文件。按照小精灵导出一个.cer Base64编码的文件;我们将其命名为 Company。请注意,这些是 Chrome 特定的说明,但其他浏览器也有类似的步骤。
转到您的 Intellij IDEA 安装文件夹,子文件夹 /jre64/bin(或 /jre32/bin)并在那里复制 Company.cer .
在您复制证书的 bin 文件夹中打开一个 cmd 或 PowerShell(您可以在资源管理器中的空白 space 上右键单击,Windows 上下文菜单将给你一个选择)。 运行 以下命令:
keytool.exe -keystore ..\lib\security\cacerts -importcert -alias Company -file Company.cer
当提示输入密码时,请使用 changeit,这是默认的密钥库密码。当系统提示确认添加公司证书时,还要键入 yes。
重新启动 Intellij IDEA 并重试给出初始错误的操作。
好的 - 现在可以使用了:) 这是解决方案: 基于 Andrei Pietrusel 的指南(非常感谢),我对 Java 的所有安全路径应用了相同的步骤,因此:IntelliJ JRE、Java JRE's/JDK。我重新启动了 IDE 并重新启动了电脑,然后终于成功了!我生命中的 2 天,但他妈的是值得的 :)
再来一次,非常感谢安德烈!
@Edit:我使用 portacle 来管理证书。