IntelliJ / Maven回购问题

时间:2018-08-28 10:56:51

标签: java maven intellij-idea repository

我真的很想解决这个问题,这是我第二天尝试解决此问题。我尝试了网上所有可用的资源(在我能找到的东部)

我正在使用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:为nexus-maven-repository-index进行传输。属性失败。

2:当我检查Maven项目详细信息时,插件和依赖项带有红色下划线。

这是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

请帮助

2 个答案:

答案 0 :(得分:2)

基于原始帖子评论中提供的答案,我得出的结论是,贵公司使用代理来拦截网络流量。本质上,它动态地将公司特定的证书添加到您访问的所有HTTPS站点的证书路径的顶部。

要在Java应用程序中信任公司特定的证书,必须将其添加到该应用程序使用的Java密钥库中。对于带有自己的JRE的Intellij IDEA,步骤如下:

  1. 在浏览器中,转到https://www.google.com或任何其他https网站。单击地址栏左侧的锁图标,然后按照用户界面获取有关证书路径的信息。在Chrome中,您可以在单击锁定图标后单击“证书”时打开的对话框的“证书路径”标签中查看此内容。

  2. 单击层次结构中最高级证书(带有公司名称的证书),然后单击“查看证书”。单击详细信息选项卡,然后单击复制到文件。按照小向导导出.cer Base64编码的文件。我们将其命名为公司。请注意,这些是Chrome特定的说明,但其他浏览器也有类似的步骤。

  3. 转到Intellij IDEA安装文件夹的子文件夹 / jre64 / bin (或/ jre32 / bin),然后在其中复制Company.cer。

  4. 在复制证书的bin文件夹中打开一个cmd或PowerShell(您可以在资源管理器中的空白处单击鼠标右键,Windows上下文菜单将为您提供此选项)。运行以下命令:

      

    keytool.exe -keystore .. \ lib \ security \ cacerts -importcert -alias公司-file Company.cer

    在提示您输入密码时,使用 changeit (这是默认的密钥库密码)。在提示您确认添加公司证书时,还请输入是。

  5. 重新启动Intellij IDEA,然后重试出现初始错误的操作。

答案 1 :(得分:2)

好的-它现在正在工作:) 解决方法如下: 基于Andrei Pietrusel的指导(非常感谢),我将相同的步骤应用于Java的所有安全路径,例如:IntelliJ JRE,Java JRE / JDK。我重新启动了IDE并重新启动了PC,然后终于可以了!我有2天的生活,但地狱值得:)

再一次,非常感谢Andrei!

@Edit:我使用portacle来管理证书。