【问题标题】:Adding tools.jar conditionally [closed]有条件地添加 tools.jar [关闭]
【发布时间】:2018-10-24 04:08:36
【问题描述】:

目前我已经在我的 pom 依赖项中包含了 tools.jar。在 JDK11 中,它需要从依赖项中删除。请帮助我仅在 java 版本小于 9 时将 tools.jar 包含在依赖项中,否则它应该存在于 pom 中。

【问题讨论】:

  • 你在寻找Maven toolchains: sample linked吗?或者个人资料?
  • ...你能详细说明为什么在你的依赖项中需要 tools.jar 的原因吗?

标签: java maven java-11 tools.jar


【解决方案1】:

您应该使用 Maven 配置文件 (http://maven.apache.org/guides/introduction/introduction-to-profiles.html)

<profiles>
    <profile>
        <id>java8</id>
        <activation>
            <jdk>1.8</jdk>
        </activation>
        <dependencies>  
           ...
        </dependencies>
    </profile>
</profiles>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-01
    • 2014-04-10
    相关资源
    最近更新 更多