上周我将笔记本电脑更新到了Windows 10.从那时起,intelliJ就抛出了Maven相关的错误,我无法解决。我的所有Maven插件都以红色突出显示,并显示错误:“无法读取(依赖项)的工件描述符。”。每个插件和依赖项都会发生这种情况。我还应该提到这是一个克隆的项目,适用于其他所有人,所以问题不在于pom。
我尝试过很多方法来解决这个问题,包括: 1.使高速缓存/重新启动无效 2.重新导入项目 3.重新导入Maven依赖项。 4.删除intelliJ .iml和.idea文件夹。 5.进行Maven清洁安装(稍后将触及此内容)。 6.做一个git pull并重新导入。 7.安装外部Maven(最新版本),将其添加到环境变量和intelliJ。
以下是我尝试运行时控制台的错误输出:
"C:\Program Files (x86)\Java\jdk1.8.0_31\jdk1.8.0_31\bin\java" "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.2\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.2\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=**** "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.2\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.1.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.1.2 clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for (redacted)
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 78, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building (redacted)SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.923s
[INFO] Finished at: Wed Jan 10 15:26:17 EST 2018
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.4.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.4.1: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.4.1 from/to central (http://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Process finished with exit code 1
CMD提示尝试版本/清理/干净安装我得到以下结果:
C:\Users\(redacted)\(redacted)\(redacted)>mvn clean
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for (redacted)-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 73, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building (redacted) 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.697 s
[INFO] Finished at: 2018-01-11T10:09:44-05:00
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [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:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
C:\Users\(redacted)\repos2\gpp-automated-testing>
最后,当我运行mvn clean -e以获取详细错误时,我收到以下错误:
org.apache.maven.plugin.PluginResolutionException: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org
Caused by: org.apache.maven.wagon.TransferFailedException: repo.maven.apache.org
Caused by: java.net.UnknownHostException: repo.maven.apache.org
我试图ping主机,我不确定究竟哪一种是ping主机的正确方法,所以我尝试了所有这些。
C:\Users\(redacted)\repos2\(redacted)>ping http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Ping request could not find host http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom. Please check the name and try again.
C:\Users\(redacted)\repos2\(redacted)>ping http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Ping request could not find host http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.4.1/maven-clean-plugin-2.4.1.pom. Please check the name and try again.
C:\Users\(redacted)\repos2\(redacted)>ping http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/
Ping request could not find host http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/. Please check the name and try again.
C:\Users\(redacted)\repos2\(redacted)>ping http://repo.maven.apache.org
Ping request could not find host http://repo.maven.apache.org. Please check the name and try again.
答案 0 :(得分:1)
Okey ...您遇到DNS问题...这意味着逻辑名称:repo.maven.apache.org
无法转换为IP地址......这是您的操作系统和网络管理员的问题。 ..所以你的pom和intellij都很好......
更新:
如果您有公司回购,则需要在.m2/settings.xml
文件中添加公司回购...在Windows中,该文件夹位于用户系统文件夹中
答案 1 :(得分:0)
关于波纹管警告
[WARNING] Some problems were encountered while building the effective
model for (redacted)
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-
compiler-plugin is missing. @ line 78, column 21 [WARNING] [WARNING] It is
highly recommended to fix these problems because they threaten the stability
of your build. [WARNING]
[WARNING] For this reason, future Maven versions might no longer support
building such malformed projects.
我建议你使用最新版本的maven-compiler-plugin,目前是3.7.0。对不起,我没有其他问题的解决方案。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>