0

Currently I have included tools.jar in my pom dependencies. In JDK11 it needs to be removed from dependencies. Please help me including tools.jar in dependencies only if java version is less than 9 else it should be present in pom.

user3592376
  • 221
  • 1
  • 3
  • 8
  • 1
    Are you possibly looking out for [Maven toolchains: sample linked](https://maven.apache.org/plugins/maven-compiler-plugin/examples/module-info.html)? Or maybe profiles? – Naman Oct 24 '18 at 04:12
  • 2
    ...and can you actually detail out the reason why would you need the *tools.jar* in your dependency? – Naman Oct 24 '18 at 04:31

1 Answers1

1

You should use Maven profiles (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>
Evgeniy Dorofeev
  • 133,369
  • 30
  • 199
  • 275