日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

解决 Maven 报错 Non-resolvable parent POM ... was cached in the local repository, resolution will not be

發布時間:2024/4/13 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 解决 Maven 报错 Non-resolvable parent POM ... was cached in the local repository, resolution will not be 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

解決 Maven 報錯 Non-resolvable parent POM ... was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM

??筆者使用 IntelliJ IDEA 對以前的項目作重構時,發現一個匪夷所思的問題:明明使用 IntelliJ IDEA 運行項目時,項目正常運行,但使用 Maven 命令進行 clean、compile、install 時,對項目中的每一個模塊,均發生如下的報錯。

筆者報錯時的運行環境:

JDK 13.0.2

Maven 3.6.3

IntelliJ IDEA 2020.1.2 (Ultimate Edition)

??這個報錯的信息如下:

"C:\Program Files\Java\jdk-13.0.2\bin\java.exe" -Dmaven.multiModuleProjectDirectory=XXX -Xms128m -Xmx512m "-Dmaven.home=XXX\plugins\maven\lib\maven3" "-Dclassworlds.conf=XXX\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=XXX\plugins\maven\lib\maven-event-listener.jar" "-javaagent:XXX\lib\idea_rt.jar=25353:XXX\bin" -Dfile.encoding=UTF-8 -classpath "XXX\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;XXX\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.versionXXXorg.apache.maven.plugins:maven-clean-plugin:2.5:clean [INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [WARNING] 'artifactId' contains an expression but should be a constant. @ line 17, column 17 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.junit.jupiter:junit-jupiter:jar -> duplicate declaration of version (?) @ line 35, column 21 [WARNING] 'artifactId' contains an expression but should be a constant. @ XXX:${project_artifactId}:${project_version}, XXX\pom.xml, line 13, column 17 [WARNING] 'version' contains an expression but should be a constant. @ XXX:${project_artifactId}:${project_version}, XXX\pom.xml, line 14, column 14 [WARNING] 'parent.relativePath' of POM XXX:${project_artifactId}:XXX (XXX\XXX\pom.xml) points at XXX:${project_artifactId} instead of XXX:XXX-project, please verify your project structure @ line 9, column 13 [FATAL] Non-resolvable parent POM for XXX:${project_artifactId}:XXX: Failure to find XXX:XXX-project:pom:XXX in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 9, column 13 [WARNING] 'artifactId' contains an expression but should be a constant. @ line 17, column 17 [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.junit.jupiter:junit-jupiter:jar -> duplicate declaration of version (?) @ line 29, column 21 [WARNING] 'artifactId' contains an expression but should be a constant. @ XXX:${project_artifactId}:${project_version}, XXX\pom.xml, line 13, column 17 [WARNING] 'version' contains an expression but should be a constant. @ XXX:${project_artifactId}:${project_version}, XXX\pom.xml, line 14, column 14 [WARNING] 'parent.relativePath' of POM XXX:${project_artifactId}:XXX (XXX\XXX-exception\pom.xml) points at XXX:${project_artifactId} instead of XXX:XXX-project, please verify your project structure @ line 9, column 13 [FATAL] Non-resolvable parent POM for XXX:${project_artifactId}:XXX: Failure to find XXX:XXX-project:pom:XXX in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 9, column 13 [WARNING] 'artifactId' contains an expression but should be a constant. @ XXX:${project_artifactId}:${project_version}, XXX\pom.xml, line 13, column 17 [WARNING] 'version' contains an expression but should be a constant. @ XXX:${project_artifactId}:${project_version}, XXX\pom.xml, line 14, column 14@ [ERROR] The build could not read 2 projects -> [Help 1] [ERROR] [ERROR] The project XXX:${project_artifactId}:XXX (XXX\XXX\pom.xml) has 1 error [ERROR] Non-resolvable parent POM for XXX:${project_artifactId}:XXX: Failure to find XXX:XXX-project:pom:XXX in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 9, column 13 -> [Help 2] [ERROR] [ERROR] The project XXX:${project_artifactId}:XXX (XXX\XXX-exception\pom.xml) has 1 error [ERROR] Non-resolvable parent POM for XXX:${project_artifactId}:XXX: Failure to find XXX:XXX-project:pom:XXX in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 9, column 13 -> [Help 2] [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/ProjectBuildingException [ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

??在筆者不斷地新建工程,不斷地隔離模塊的努力下,終于發現了原因所在。(當然,每個遇到這個問題的讀者可能原因不同,這里僅供參考。)

??為了偷懶,筆者編寫了一個愚蠢的代碼。這段代碼類似如下:

<properties><project_artifactId>demo-project</project_artifactId><project_version>1.2</project_version></properties><groupId>org.demo</groupId><artifactId>${project_artifactId}</artifactId><version>${project_version}</version><packaging>pom</packaging><name>{project_artifactId}</name>

??上述代碼的問題在于,對 Maven 項目的坐標使用了 <properties/...> 中的元素來代替。但實際上,<properties/...> 應該在依賴(<dependencies/...>)中使用。Maven 并未在坐標中識別出 <properties/...>,因為坐標解析發生在解析 <properties/...> 之前。同樣地,對于子 pom,雖然父 pom 中的 <properties/...> 可以被子 pom 繼承,不過在子 pom 中的 <parent/...> 坐標里同樣不能解析父 pom 中的 <properties/...>,因為必須要先明確地指定它的父 pom 坐標,然后繼承才會發生。終于知道真相的筆者眼淚掉下來。希望讀者引以為戒。

總結

以上是生活随笔為你收集整理的解决 Maven 报错 Non-resolvable parent POM ... was cached in the local repository, resolution will not be的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。