Beside mvn test
and the build process I want to run Maven and it should fail on violations. I tried different options in pom.xml but nothing worked. failOnViolation
and failsOnError
didn't help.
I can run mvn checkstyle:check
and it outputs the errors to the console (suing <consoleOutput>true</consoleOutput>
). But how can I run checkstyle and let it fail on violations?
This is what I tryied so far:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<failOnViolation>true</failOnViolation>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>