gpt4 book ai didi

java - IntelliJ/Maven repo 问题

转载 作者:行者123 更新时间:2023-11-29 07:26:21 26 4
gpt4 key购买 nike

我真的被这个问题困扰了,这是我尝试修复它的第二天。我尝试了网络上所有可用的资源(至少是我能找到的)

我正在使用 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:

当我在不使用原型(prototype)的情况下构建新项目时,maven 根本无法工作 - 并出现以下错误:

1:当我检查 Maven 存储库时,我可以看到 repo.aven.apache.org/maven2 的错误:java.lang.RuntimeException: java.io.IOException: Transfer for nexus-maven-repository-index。属性失败。

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

请帮忙

最佳答案

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

要在 Java 应用程序中信任您公司特定的证书,您必须将它添加到该应用程序使用的 java keystore 中。以Intellij IDEA为例,自带JRE,步骤如下:

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

  2. 单击层次结构中最顶层 的证书(带有贵公司名称的证书),然后单击查看证书。单击详细信息选项卡,然后单击复制到文件。按照小 Sprite 导出一个.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 Company -file Company.cer

    当提示输入密码时,请使用 changeit,这是默认的 keystore 密码。当系统提示确认添加公司证书时,还要键入 yes。

  5. 重新启动 Intellij IDEA 并重试给出初始错误的操作。

关于java - IntelliJ/Maven repo 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52056183/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com