Skip to content
This repository has been archived by the owner on Mar 11, 2024. It is now read-only.

deadcode4j v2.1.0: Usage

sebastiankirsch edited this page Feb 11, 2016 · 1 revision

deadcode4j provides the following goals:

deadcode4j-maven-plugin:find

Simply run mvn de.is24.mavenplugins:deadcode4j-maven-plugin:find -Dmaven.test.skip=true in the project you want to analyze. deadcode4j will trigger the package phase to be executed for a project (and for all modules listed in a reactor project) before analyzing the output directories. The output will look something like this:

[INFO] --- deadcode4j-maven-plugin:2.1.0:find (default-cli) @ someProject ---
[INFO] Analyzed 42 class(es).
[WARNING] Found 3 unused class(es):
[WARNING]   de.is24.deadcode4j.Foo
[WARNING]   de.is24.deadcode4j.Bar
[WARNING]   de.is24.deadcode4j.SomeAnnotatedClass

The -Dmaven.test.skip=true part skips compiling & executing tests, as they are not relevant for the analysis. Likewise, you may add -Dinvoker.skip=true if you're using the invoker plugin.

If not configured otherwise, deadcode4j will request your permission to send some usage statistics. Use Maven's -B parameter to prevent user interaction. Using Maven's -o parameter will skip sending usage statistics and checking for updates - even if configured otherwise.

This goal can be adapted to your needs.

deadcode4j-maven-plugin:find-only

As an alternative, you can run mvn de.is24.mavenplugins:deadcode4j-maven-plugin:find-only which performs the same analysis, but without triggering the package phase. This is intended for repeated analysis (e.g. after updating the configuration) or if your project is already packaged.

This goal supports the same configuration as find.

deadcode4j-maven-plugin:help

Lists the available goals & parameters.