maven编译问题之-ThePOMforXXXisinvalid,transitivede。。。问题⼀:把⽗⼯程tao-parent install 到maven本地仓后,接着install tao-common⼯程,然后报错
报错信息如下:
[WARNING] The POM for com.:jackson-databind:jar:2.4.2 is invalid, transitive dependencies (if any) will not be available,enable debug logging for more details
错误信息意思是 com.:jackson-databind:jar:2.4.2 这个jar包的POM⽂件⽆效,依赖传递不可⽤;
解决办法:在install 时,使⽤调试模式, install -X ,将控制台的信息拷贝出来,查[WARNING]信息,可以看到如下错误提⽰:[WARNING] The POM for com.: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.: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 batis: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 batis: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 batis: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 @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              & @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              & @1387:17)  @ D:\apache-maven-3.5.2\Maven\org\apache\commons\commons-parent\34\commons-parent-34.pom, line 1387, column 17
maven打包本地jar包可以得知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 ==》(选择带...的这个),
在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错误信息
参考资料:

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。