【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

你可能感兴趣的:(maven,maven,druid)