I'm trying to use detekt in a multi-module Maven project using Kotlin with the detekt-maven-plugin.
Following the instructions found here to generate a baseline with the existing issues, I tried running:
mvn detekt:cb -Ddetekt.debug=true
This does not seem to produce the mentioned baseline.xml
file however.
Turns out that the baseline filename must be specified when baseline is generated:
mvn detekt:cb -Ddetekt.baseline=baseline.xml
Since the code base already had quite a few issues found by detekt, I also had to use a custom detekt config file and increase the number of allowed issues - otherwise the build would fail and no baseline would be generated at all.
To summarize, the following configuration made it work:
detekt config file:
build:
maxIssues: 1000
Plugin configuration after the baseline was generated:
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>1.1.1</version>
<configuration>
<baseline>detekt-baseline.xml</baseline>
<config>detekt-config.yml</config>
<buildUponDefaultConfig>true</buildUponDefaultConfig>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
After the baseline was generated, the maxIssuses
value in the config file could be lowered to an appropriate value.