-
Notifications
You must be signed in to change notification settings - Fork 5
deadcode4j v2.1.0: Configuration
If you want to configure the plugin and make use of some of its features, list deadcode4j in your pom.xml
:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>de.is24.mavenplugins</groupId>
<artifactId>deadcode4j-maven-plugin</artifactId>
<version>2.1.0</version>
<configuration>
<annotationsMarkingLiveCode>
<param>de.is24.deadcode4j.LiveCode</param>
</annotationsMarkingLiveCode>
<classesToIgnore>
<!-- Java main class which IS used, I swear -->
<param>de.is24.deadcode4j.Foo</param>
</classesToIgnore>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Note that it if you do not intend to bind deadcode4j to a lifecycle phase, it is sufficient to define deadcode4j under the pluginManagement
section as listed above.
Now run mvn de.is24.mavenplugins:deadcode4j-maven-plugin:find-only
(assuming your project is packaged) and you'll get
[INFO] --- deadcode4j-maven-plugin:2.1.0:find-only (default-cli) @ someProject ---
[INFO] Analyzed 42 class(es).
[INFO] Ignoring 1 class(es) which seem(s) to be unused.
[WARNING] Found 1 unused class(es):
[WARNING] de.is24.deadcode4j.Bar
-
annotationsMarkingLiveCode
A list of fully qualified annotation classes which, if applied, mark classes as being live code.
-
classesToIgnore
A list of fully qualified classes that should be ignored by deadcode4j (and thus not listed as being dead).
-
customXmls
A list of definitions on how to analyze XML files:
<customXmls> <customXml> <endOfFileName>.xml</endOfFileName> <rootElement>root</rootElement> <xPaths> <param>element/text()</param> <param>anotherElement[@attributeValue='mandatory']/text()</param> <param>thirdElement/@attribute</param> </xPaths> </customXml> <!-- more custom XML --> </customXmls>
-
endOfFileName (mandatory)
The file suffix that needs to be matched in order to analyze a file.
-
rootElement
The name of the root element that needs to be matched in order to analyze an XML file; specifying a root element speeds up the analysis.
-
xPaths (mandatory)
A list of XPath definitions identifying an XML node which is to be recognized as a class being in use. Supported expressions are:
element/text()
andelement/@attribute
; anelement
can be restricted to have a specific attribute value by definingelement[@requiredAttribute='requiredValue']
.
-
-
ignoreMainClasses
Mark all classes with a
main
method as being live code. -
interfacesMarkingLiveCode
A list of fully qualified interface names which, if implemented, mark classes as being live code.
-
modulesToSkip
A list of the modules to skip.
-
skipSendingUsageStatistics
Set to
true
to skip sending usage statistics; set tofalse
to send statistics without user interaction. When running Maven with the-o
flag, sendings statistics is skipped. Likewise, if this property is not set tofalse
and Maven runs with the-B
flag, statistics are not send.
User property isdeadcode4j.skipSendingStatistics
-
skipUpdateCheck
Set to
true
to skip the update check performed at startup. When running Maven with the-o
flag, checking for updates is skipped.
User property isdeadcode4j.skipUpdate
-
superClassesMarkingLiveCode
A list of fully qualified class names which, if extended, mark classes as being live code.
-
usageStatisticsComment
A comment to send along with the usage statistics.
State a testimonial, refer to your project, provide a way to contact you, request a feature, have fun!
User property isdeadcode4j.statisticsComment