首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >intelliJ中的Maven无法读取项目描述符-已启用快照更新

intelliJ中的Maven无法读取项目描述符-已启用快照更新
EN

Stack Overflow用户
提问于 2018-01-11 23:22:31
回答 2查看 5.7K关注 0票数 2

上周,我的笔记本电脑更新到了Windows10,从那时起,intelliJ抛出了与Maven相关的错误,我一直无法解决这些错误。我的所有Maven插件都以红色突出显示,并显示错误:“无法读取(依赖项)的工件描述符。”每一个插件和依赖项都会发生这种情况。我还应该提到的是,这是一个克隆项目,适用于其他所有人,所以问题不在于pom。

以下是我的Maven设置的屏幕截图:

我尝试了许多方法来解决这个问题,包括: 1.无效缓存/重新启动2.重新导入项目3.重新导入Maven依赖项。4.删除intelliJ .iml和.idea文件夹。5.执行Maven干净安装(稍后将涉及到这一点)。6.执行git拉取并重新导入。7.安装外部Maven (最新版本),将其添加到环境变量和intelliJ中。

以下是我尝试运行时控制台的错误输出:

代码语言:javascript
运行
复制
"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提示尝试进行版本/清理/干净安装时,我会得到以下结果:

代码语言:javascript
运行
复制
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查看详细错误时,我得到了以下错误:

代码语言:javascript
运行
复制
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主机的正确方式,所以我都尝试了。

代码语言:javascript
运行
复制
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.
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-01-11 23:49:27

好的..。您的DNS有问题...这意味着逻辑名称:repo.maven.apache.org不能转换为IP地址...这是您的操作系统和网络管理员的问题...所以你的pom和intellij都没问题。

更新:如果你有一个公司回购,你需要在你的.m2/settings.xml文件中添加公司回购...在windows中,该文件夹位于用户系统文件夹中。

票数 2
EN

Stack Overflow用户

发布于 2018-01-11 23:49:39

关于波纹管警告

代码语言:javascript
运行
复制
[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.

我建议你使用目前3.7.0版本的最新maven-compiler-plugin。很抱歉,我没有解决剩下的问题的办法。

代码语言:javascript
运行
复制
 <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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48210453

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档