maven編譯問題之 -The POM for XXX is invalid, transitive dependencies (if any) will not be available


問題一: 把父工程tao-parent install 到maven本地倉后,接着install tao-common工程,然后報錯

報錯信息如下:

[WARNING] The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.4.2 is invalid, transitive dependencies (if any) will not be available,enable debug logging for more details

錯誤信息意思是 com.fasterxml.jackson.core:jackson-databind:jar:2.4.2 這個jar包的POM文件無效,依賴傳遞不可用;

解決辦法:在install 時,使用調試模式, install -X ,將控制台的信息拷貝出來,查找[WARNING]信息,可以看到如下錯誤提示:

[WARNING] The POM for com.fasterxml.jackson.core:jackson-databind:jar:2.4.2 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for com.fasterxml.jackson.core:jackson-databind:2.4.2

[FATAL] Non-parseable POM D:\apache-maven-3.5.2\Maven\com\fasterxml\jackson\jackson-parent\2.4\jackson-parent-2.4.pom: processing instruction can not have PITarget with reserved xml name (position: END_TAG seen ...</build>\n\n</project>\n<?xml ... @180:7)  @ D:\apache-maven-3.5.2\Maven\com\fasterxml\jackson\jackson-parent\2.4\jackson-parent-2.4.pom, line 180, column 7

 

提示信息指向了 D:\apache-maven-3.5.2\Maven\com\fasterxml\jackson\jackson-parent\2.4\目錄下的  jackson-parent-2.4.pom文件

 

找到該POM文件 180行,看到有提示信息,將jackson-parent\2.4目錄下的所有文件刪除,然后重新使用install命令把tao-common打包到本地maven倉正常,正常倉庫下的文件如下,這個 jackson-parent-2.4.pom文件和之前的 jackson-parent-2.4.pom文件的內容也不相同 !

 

問題二:上面問題解決后,install tao-manager時,報如下告警信息:

[WARNING] The POM for org.mybatis:mybatis-spring:jar:1.2.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

[WARNING] The POM for commons-logging:commons-logging:jar:1.2 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details 

 選中項目,右鍵->run as ,選擇maven build ...,然后在對話框中的Goals項填入" dependency:tree",再在"debug output"打上勾,並將此項啟動的名字改為"showDependency-tree",然后點擊Run按鈕, 獲取maven依賴關系,執行后,將控制台的調試信息拷貝出來,查找FATAL級別的,如下:

[WARNING] The POM for org.mybatis:mybatis-spring:jar:1.2.2 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for org.mybatis:mybatis-spring:1.2.2
[FATAL] Non-parseable POM D:\apache-maven-3.5.2\Maven\org\mybatis\mybatis-parent\20\mybatis-parent-20.pom: only whitespace content allowed before start tag and not o (position: START_DOCUMENT seen o... @1:1) @ D:\apache-maven-3.5.2\Maven\org\mybatis\mybatis-parent\20\mybatis-parent-20.pom, line 1, column 1

[WARNING] The POM for commons-logging:commons-logging:jar:1.2 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for commons-logging:commons-logging:1.2

[FATAL] Non-parseable POM D:\apache-maven-3.5.2\Maven\org\apache\commons\commons-parent\34\commons-parent-34.pom: start tag not allowed in epilog but got p (position: END_TAG seen ...</properties>\r\n\r\n</project>\r\n              <p... @1387:17)  @ D:\apache-maven-3.5.2\Maven\org\apache\commons\commons-parent\34\commons-parent-34.pom, line 1387, column 17

[WARNING] The POM for commons-logging:commons-logging:jar:1.2 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for commons-logging:commons-logging:1.2

[FATAL] Non-parseable POM D:\apache-maven-3.5.2\Maven\org\apache\commons\commons-parent\34\commons-parent-34.pom: start tag not allowed in epilog but got p (position: END_TAG seen ...</properties>\r\n\r\n</project>\r\n              <p... @1387:17)  @ D:\apache-maven-3.5.2\Maven\org\apache\commons\commons-parent\34\commons-parent-34.pom, line 1387, column 17

 可以得知D:\apache-maven-3.5.2\Maven\org\apache\commons\commons-parent\34\路徑下的 commons-parent-34.pom文件

D:\apache-maven-3.5.2\Maven\org\mybatis\mybatis-parent\20路徑下的  mybatis-parent-20.pom文件損壞。刪除后更新maven倉庫,然后install正常

 

經驗提升:

1.maven編譯問題,有可能是某些需要的文件壞了,刪除后右鍵單擊工程名==》maven ==》 update project , 更新 一下maven倉就解決了

2.遇到maven編譯問題,可以使用maven調試模式,獲取更精確的問題信息,從而快速定位問題  具體步驟是: 右鍵單擊工程名==》run as ==》maven build...(選擇帶...的這個),

在Goals后面輸入clean install -X ,之所以加上clean命令,是為了清除之前打到本地倉的包

3. 如何查lib下的jar來自哪個maven依賴(用於解決jar版本沖突,第三方依賴jar包pom文件損壞問題):

選中項目,右鍵->run as ,選擇maven build ...,然后在對話框中的Goals項填入" dependency:tree",再在"debug output"打上勾,並將此項啟動的名字改為"showDependency-tree",然后點擊“Debug"/Run按鈕, console里面會很詳細地顯示每個pom里面配置的依賴它們會帶來哪些jar文件,以及jar包,pom錯誤信息 

參考資料:

https://www.cnblogs.com/woshicckk/p/6410477.html 

https://blog.csdn.net/rocklee/article/details/51691617 

 

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM