The Only Maven Plugin That Understands JDeps
This plugin is all about JDeps and particularly about JDK-internal APIs. With Java 9 (scheduled for 03/2017) such APIs will become unavailable, which may break a project. Redemption comes in four easy steps:
- identify your projects' problematic dependencies
- create a plan to move away from them
- prevent relapses
- do the same for your dependencies
This plugin helps with
How Does It Help?
jdeps -jdkinternals against the compiled classes it will discover dependencies on internal APIs.
But it not only runs JDeps, it also understands its output, which allows a convenient and detailed configuration of when exactly the build should break.
This enables a self-paced migration away from problematic dependencies with immediate failure on relapses.
Since JDeps Mvn actually understands JDeps, it is straight forward to define flexible rules for how dependencies are treated. So you have this package where the use of
sun.misc is generally ok except for the one subpackage where everything but
Unsafe could already be removed and must not creep back? No problem:
org.food -> sun.misc: WARN org.food.fruit -> sun.misc: FAIL org.food.fruit -> sun.misc.Unsafe: WARN
You find it too tedious to write all these rules by hand? Also no problem. Check out the walkthrough for more on rules, including how to create them automatically.
To get a first impression how you're doing JDK-internal-wise simply run JDeps Mvn:
mvn clean compile org.codefx.mvn:jdeps-maven-plugin:jdkinternals
This will log every dependency jdeps reports to the console (on level
Adding the following to your pom yields the same result as above but on every run:
<plugin> <groupId>org.codefx.mvn</groupId> <artifactId>jdeps-maven-plugin</artifactId> <version>0.2</version> <executions> <execution> <configuration> <!-- define known and acceptable dependencies here (see below) --> </configuration> <goals> <goal>jdkinternals</goal> </goals> </execution> </executions> </plugin>
To explicitly run this plugin you can do one of these:
mvn clean compile jdeps:jdkinternals # just this plugin mvn verify # everything up to the phase in which this plugin runs