You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by ecthelion <ta...@yahoo.com> on 2014/07/29 01:07:04 UTC
Maven build does not fail due to checkstyle errors
I configured Maven to use the checkstyle plugin.
Here is what I have in pom.xml's build section :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<consoleOutput>true</consoleOutput>
<logViolationsToConsole>true</logViolationsToConsole>
<failOnViolation>true</failOnViolation>
<configLocation>${basedir}/.../checkstyle-config.xml
</configLocation>
</configuration>
</plugin>
I am getting checkstyle errors in Eclipse using the same configuration file
but Maven build does not fail. It builds the project successfully.
I am trying to stop the maven build if there is a checkstyle issue with the
code.
Is there something I am missing?
Thanks.
--
View this message in context: http://maven.40175.n5.nabble.com/Maven-build-does-not-fail-due-to-checkstyle-errors-tp5801275.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven build does not fail due to checkstyle errors
Posted by ecthelion <ta...@yahoo.com>.
Thanks for your response.
I was actually missing the <violationSeverity> from the <configuration> and
all of my errors were actually warnings.
I set it to <violationSeverity>warning</violationSeverity> and it worked.
--
View this message in context: http://maven.40175.n5.nabble.com/Maven-build-does-not-fail-due-to-checkstyle-errors-tp5801275p5801305.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Maven build does not fail due to checkstyle errors
Posted by Manfred Moser <ma...@mosabuam.com>.
You either have to execute it manually with
mvn checkstyle:check
or if you want it to run as part of a normal build you have to bind it to a lifecycle phase in the config
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
Also ... check out the setup on for reusing the config file without having relative paths..
https://github.com/mosabua/ksoap2-android/blob/master/pom.xml
hth
manfred
ecthelion wrote on 28.07.2014 16:07:
> I configured Maven to use the checkstyle plugin.
>
> Here is what I have in pom.xml's build section :
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-checkstyle-plugin</artifactId>
> <version>2.5</version>
> <executions>
> <execution>
> <goals>
> <goal>check</goal>
> </goals>
> </execution>
> </executions>
> <configuration>
> <consoleOutput>true</consoleOutput>
> <logViolationsToConsole>true</logViolationsToConsole>
> <failOnViolation>true</failOnViolation>
> <configLocation>${basedir}/.../checkstyle-config.xml
> </configLocation>
> </configuration>
> </plugin>
>
> I am getting checkstyle errors in Eclipse using the same configuration file
> but Maven build does not fail. It builds the project successfully.
>
> I am trying to stop the maven build if there is a checkstyle issue with the
> code.
>
> Is there something I am missing?
>
> Thanks.
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Maven-build-does-not-fail-due-to-checkstyle-errors-tp5801275.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org