Includes JDeps in Maven
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
pom.xml

README.md

JDeps Mvn

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:

  1. identify your projects' problematic dependencies
  2. create a plan to move away from them
  3. prevent relapses
  4. do the same for your dependencies

This plugin helps with 1️⃣ and 3️⃣, 2️⃣ shouldn't be too hard in most cases but 4️⃣ might be.

How Does It Help?

Running 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.

Quick Start 🚀

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 WARN).

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

Next steps 💢

But we're all too good in ignoring log messages so check out the walkthrough and the rest of the wiki for information on how to advance to the next level.

Contact 👀

Nicolai Parlog
CodeFX

Web: http://codefx.org
Twitter: https://twitter.com/nipafx
Mail: nipa@codefx.org
PGP-Key: http://keys.gnupg.net/pks/lookup?op=vindex&search=0xA47A795BA5BF8326