【WARNING】The POM for com.alibaba:druid:jar:1.1.21 is invalid 警告問題

運行一個基於maven的web-app骨架創建的工程時,報瞭如下[警告]

The POM for com.alibaba:druid:jar:1.1.21 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details

-> 開啓debug模式,查看詳細信息

[Windows]+R快捷鍵打開【cmd】命令行,cd進入當前項目所在目錄:E:\IdeaProjects\maven_advanced_01

--cmd輸出DEBUG信息
mvn clean install -X
--或者直接把DEBUG信息輸出到本地的debug.txt文件
mvn clean install -X > debug.txt

打印輸出項目運行的DEBUG信息,發出一個警告

[WARNING] The POM for com.alibaba:druid:jar:1.1.21 is invalid, transitive dependencies (if any) will not be available: 4 problems were encountered while building the effective model for com.alibaba:druid:1.1.21
[ERROR] 'dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${project.basedir}/lib/openjdk-1.8-tools.jar @
[ERROR] 'dependencies.dependency.systemPath' for com.sun:jconsole:jar must specify an absolute path but is ${project.basedir}/lib/openjdk-1.8-jconsole.jar @
[WARNING] 'dependencies.dependency.systemPath' for com.alibaba:jconsole:jar refers to a non-existing file D:\Program Files\Java\jdk-13.0.2\lib\jconsole.jar @
[WARNING] 'dependencies.dependency.systemPath' for com.alibaba:tools:jar refers to a non-existing file D:\Program Files\Java\jdk-13.0.2\lib\tools.jar @

-> 查看依賴包關係樹結構

--cmd輸出
mvn dependency:tree
--cmd輸出到本地tree.txt
mvn dependency:tree > tree.txt
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.yy:maven_advanced_01 >----------------------
[INFO] Building maven_advanced_01 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[WARNING] The POM for com.alibaba:druid:jar:1.1.21 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ maven_advanced_01 ---
[INFO] com.yy:maven_advanced_01:war:1.0-SNAPSHOT
[INFO] +- org.mybatis:mybatis:jar:3.5.4:compile
[INFO] +- org.mybatis:mybatis-spring:jar:2.0.4:compile
[INFO] +- com.github.pagehelper:pagehelper:jar:5.1.11:compile
[INFO] |  \- com.github.jsqlparser:jsqlparser:jar:2.0:compile
[INFO] +- mysql:mysql-connector-java:jar:8.0.19:runtime
[INFO] |  \- com.google.protobuf:protobuf-java:jar:3.6.1:runtime
[INFO] +- com.alibaba:druid:jar:1.1.21:compile
[INFO] +- c3p0:c3p0:jar:0.9.1.2:compile
[INFO] +- org.springframework:spring-context:jar:5.2.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:5.2.4.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:5.2.4.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jcl:jar:5.2.4.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-beans:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-web:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-jdbc:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-aspects:jar:5.2.4.RELEASE:compile
[INFO] |  \- org.aspectj:aspectjweaver:jar:1.9.5:compile
[INFO] +- org.springframework:spring-jms:jar:5.2.4.RELEASE:compile
[INFO] |  \- org.springframework:spring-messaging:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-context-support:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-test:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework:spring-orm:jar:5.2.4.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-web:jar:5.3.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-config:jar:5.3.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-core:jar:5.3.0.RELEASE:compile
[INFO] +- org.springframework.security:spring-security-taglibs:jar:5.3.0.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-acl:jar:5.3.0.RELEASE:compile
[INFO] +- jstl:jstl:jar:1.2:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:4.0.1:provided
[INFO] +- javax.servlet:jsp-api:jar:2.0:provided
[INFO] |  \- javax.servlet:servlet-api:jar:2.4:provided
[INFO] +- log4j:log4j:jar:1.2.17:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.30:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.30:test
[INFO] +- org.slf4j:slf4j-simple:jar:1.6.6:compile
[INFO] \- junit:junit:jar:4.12:test
[INFO]    \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.447 s
[INFO] Finished at: 2020-03-22T19:31:38+08:00
[INFO] ------------------------------------------------------------------------

 


#1-> 警告的詳細內容如下

[WARNING] The POM for com.alibaba:druid:jar:1.1.21 is invalid, transitive dependencies (if any) will not be available: 4 problems were encountered while building the effective model for com.alibaba:druid:1.1.21
[ERROR] 'dependencies.dependency.systemPath' for com.sun:tools:jar must specify an absolute path but is ${project.basedir}/lib/openjdk-1.8-tools.jar @ 
[ERROR] 'dependencies.dependency.systemPath' for com.sun:jconsole:jar must specify an absolute path but is ${project.basedir}/lib/openjdk-1.8-jconsole.jar @ 
[WARNING] 'dependencies.dependency.systemPath' for com.alibaba:jconsole:jar refers to a non-existing file D:\Program Files\Java\jdk-13.0.2\lib\jconsole.jar @ 
[WARNING] 'dependencies.dependency.systemPath' for com.alibaba:tools:jar refers to a non-existing file D:\Program Files\Java\jdk-13.0.2\lib\tools.jar @ 

#2-> 運行環境 :InteIliJ IDEA 2019.3.3 (Ultimate Edition) + jdk 13.0.2 + apache maven 3.6.3

#3-> 嘗試解決問題

一開始在網上看了很多博客,都沒有解決這個問題。

- 有人說是JDK的環境變量沒有配好,確認過jdk環境配置沒有問題。

- 有人說要修改這裏的${project.basedir},但他們基本是在使用gradle的時候遇到這個問題的,感覺跟我遇到的問題也不太一樣。最關鍵的是根本找不到這個默認的${project.basedir}地址在哪裏,也不知道去哪個文件裏修改這個路徑。

所以這裏的兩個 [ERROR] 說要指定一個絕對路徑,但找不到${project.basedir},修改絕對路徑這條路算是沒法玩了。

這裏還有兩個 [WARNING] 顯示找不到JAVA_HOME\lib下的tools.jarjconsole.jar,但是我使用的JDK最新版13.0.2默認安裝完成以後本身就沒有JRE目錄,自己生成JRE目錄之後,也找不到這倆文件。

百度了一下,原來新版本的jdk自9.+之後就沒有JRE目錄了,同時這兩個文件也找不到了,配置環境變量的時候也省去了這兩個路徑的配置,直接把JAVA_HOME/bin掛到path就可以了。

那怎麼辦,難道要換JDK版本嗎?但是爲什麼這個警告的提示僅僅只報了com.alibaba.druid這一個單獨的jar包呢?如果jdk有問題整個項目應該都無法運行纔對。

這纔開始考慮是不是跟引入的com.alibaba.druid這個jar包有關,我用的這個連接池是最新版1.1.21,我嘗試降低了jar包的版本,改成1.1.20,就解決了。=b

針對最新版1.1.21,看到很多小夥伴跟我遇到了同樣的問題,所以合理的懷疑這可能是個官方bug。

https://github.com/alibaba/druid/issues/3564

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章