A maven plugin that wraps the Detekt CLI. It supports the same parameters as the Detekt CLI.
<build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Using the above configuration, Detekt will scan source files in ${basedir}/src and output the results in ${basedir}/detekt.
All parameters available to Detekt version 1.0.0 can be configured in the plugin.
<build>
<plugins>
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.1.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals><goal>check</goal></goals>
<configuration>
<report>
<report>txt:reports/detekt.txt</report>
<report>xml:reports/detekt.xml</report>
</report>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
check
Used to run detekt. All cli parameters, excluding -gc and -cb, are available using -Ddetekt.{parameter}
Examples
mvn detekt:check -Ddetekt.config=detekt.yml
mvn detekt:check -Ddetekt.debug=true
create-baseline
Used to create a baseline. All cli parameters, excluding -gc and -cb, are available using -Ddetekt.{parameter}
Examples
mvn detekt:cb -Ddetekt.config=detekt.yml
mvn detekt:cb -Ddetekt.debug=true
mvn detekt:create-baseline -Ddetekt.config=detekt.yml
mvn detekt:create-baseline -Ddetekt.debug=true
generate-config
Used to generate a default configuration file
Example
mvn detekt:gc
mvn detekt:generate-config
For more information on Detekt, have a look at https://github.com/arturbosch/detekt