Closed olxmute closed 4 years ago
The reason for this is a difference in how the two plugins are configured. The check style plugin has it's configuration outside of the execution block, and the detekt plugin has it inside the execution block.
If you define a configuration block outside of the executions block it will work as you expect, like this
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
<version>${detekt-maven-plugin.version}</version>
<configuration>
<config>config/detekt/detekt-config.yml</config>
<baseline>config/detekt/baseline.xml</baseline>
<report>
<report>html:target/reports/detekt.html</report>
</report>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<config>config/detekt/detekt-config.yml</config>
<baseline>config/detekt/baseline.xml</baseline>
<report>
<report>html:target/reports/detekt.html</report>
</report>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.gitlab.arturbosch.detekt</groupId>
<artifactId>detekt-formatting</artifactId>
<version>${detekt-maven-plugin.version}</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
To make it simpler, if you want the same configuration for mvn detekt:check
as for mvn clean install
, you could remove the configuration block from inside the execution block.
Thanks, it helped! Now ot works as expected.
I've been configuring the plugin following your README and didn't know about this maven plugins configuration feature. I think it would be helpful for newcomers if you add this case to examples in README.
Yeah, I'll add it to the readme when I merge the latest detekt version.
Hi @Ozsie ! Thanks a lot, this also helped me!
Just one more thing, I uploaded the configuration file to Amazon S3 bucket, but I can't make the plugin work by providing the public URL. Is this not supported yet?
I would say you have to check with detekt directly, the parameters are passed on to the detekt CLI as strings, so if it doesn't work it's something detekt does not support.
I have checkstyle plugin for Java in the project. In pom.xml I have such config that contains paths to checkstyle configuration and supressions files:
When I run mvn checkstyle:check maven excecutes plugin using configuration from pom.xml.
And I have similar config for detekt:
But if I want to run mvn detekt:check maven will use default detekt configuration instead of the pom.xml one. Maven use that config only during mvn clean install. I think it would be great if it we could excecute mvn detekt:check with config from pom.xml like we doing with checkstyle plugin.