Druid 编译问题 jar must specify an absolute path but is ${env.JAVA_HOME}jconsole.jar

此文章发布于 53 个月前,部分信息可能已经过时,请自行斟酌确认。

问题描述

升级了 jdk11 后使用 druid 编译报以下警告。

参考:
https://github.com/alibaba/druid/issues/3060
https://github.com/alibaba/druid/issues/2491
https://github.com/alibaba/druid/issues/1346

> Task :compileJava UP-TO-DATE
Errors occurred while build effective model from D:\Android\.gradle\caches\modules-2\files-2.1\com.alibaba\druid\1.1.20\afe9cd598f6fc1a2771819c36f4a004fb9a2a2e1\druid-1.1.20.pom:
    'dependencies.dependency.systemPath' for com.alibaba:jconsole:jar must specify an absolute path but is ${env.JAVA_HOME}/lib/jconsole.jar in com.alibaba:druid:1.1.20
    'dependencies.dependency.systemPath' for com.alibaba:tools:jar must specify an absolute path but is ${env.JAVA_HOME}/lib/tools.jar in com.alibaba:druid:1.1.20

20191023160434549.png

解决方案

找了半天找不到解决方案,阿里官方仓库回复说编译有问题,运行没问题,1年多没解决。

阿里的大牛没闲功夫解决这种小问题,无奈...

只能自己动手,既然运行没问题,那去掉这个东东吧

编辑:afe9cd598f6fc1a2771819c36f4a004fb9a2a2e1\druid-1.1.20.pom
找到 com.alibaba:jconsolecom.alibaba:toolsjar 的依赖注释掉。

20191024090607771.png

<dependencies>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>jconsole</artifactId>
        <version>1.6.0</version>
        <scope>system</scope>
        <systemPath>${jconsolejar}</systemPath>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>com.alibaba</groupId>
        <artifactId>tools</artifactId>
        <version>1.6.0</version>
        <scope>system</scope>
        <systemPath>${toolsjar}</systemPath>
        <optional>true</optional>
    </dependency>
</dependencies>

其它讨论:

openJdk 没有 druid 所需的 jconsole.jar 包。

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

解决方案: 使用 Oracle JDK (收费)

20191203_174740.png

最后修改:2019 年 12 月 03 日 05 : 50 PM
如果觉得我的文章对你有用,请随意赞赏

1 条评论

  1. kgod

    刚好也看到了

发表评论