You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by teja007 <te...@gmail.com> on 2009/02/10 16:38:49 UTC
Re: How can the checkstyle plugin be configured to fail the build?
nitinaggarwal wrote:
>
> Hi
>
> I am facing a similiar issue in my project.
> But additionally i want the a checkstyle file FC-CheckStyle.xml
> customized to my project be invoked in order to find out if there are
> checkstyle errors .
>
> how do i do that?
>
> Additionally can some one tell me how can i refer to this file as this is
> located in my root directory
> and i want to invoke the file in a directory fc
> to be more clear i will provide a brief about my project.
>
> FC-4.0 Source-->application-->fc (my pom is here)
> -->er (and here)
>
> -->portal
> --> components-->pom
> --> pom
>
>
> Can some one suggest me how to perform this checkstyle validation.
> would you suggest me the validation to be at the top level or at every
> level as i am having a multli project build.
>
> but the issue with this approach is that all the developers would have to
> build the entire project rather than a sub project for finding out check
> style errors.
>
> any comments how we can extend something from the top level pom.
>
> Nitin
>
> nitin.fbsi.aggarwal@fidelity.com
>
>
>
>
>
>
>
> Guillaume Boucherie wrote:
>>
>> try something like this.
>>
>> <build>
>> <plugins>
>> <plugin>
>> <groupId>org.apache.maven.plugins<groupId>
>> <artifactId>maven-checkstyle-plugin</artifactId>
>> <executions>
>> <execution>
>> <goals>
>> <goal>check</goal>
>> </goals>
>> </execution>
>> </executions>
>> </plugin>
>> </plugins>
>> </build>
>>
>> by default the check goal is link to verify phase
>>
>> CletteBou
>>
>>
>> 2007/6/21, Andrew Moores <am...@yahoo.com>:
>>>
>>> Hello
>>>
>>> I want to make my build fail if there are any checkstyle errors in my
>>> code. I have added the following to my pom:
>>>
>>> <build>
>>> <plugins>
>>> <plugin>
>>> <groupId>org.apache.maven.plugins</groupId>
>>> <artifactId>maven-checkstyle-plugin</artifactId>
>>> <configuration>
>>> <failOnViolation>true</failOnViolation>
>>> </configuration>
>>> </plugin>
>>> </plugins>
>>> </build>
>>>
>>> When I execute mvn checkstyle:check my build fails when I have a
>>> checkstyle error.
>>>
>>> When I execute mvn install the build does not fail. Reading the plugin
>>> pages I expected my build to fail for the intall goal as well, what else
>>> do
>>> I need to add to the POM to make the build fail?
>>>
>>> I am running Maven 2.0.5.
>>>
>>> Thanks
>>> Andrew
>>>
>>
>>
>
>
This would be more apt:
<build>
…..
<plugins>
…
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>checkstyle</goal> <!—checkstyle : generates the reports in a site
folder in HTML format-->
<!— check: can be used if only the errors have to be checked-->
</goals>
</execution>
</executions>
<configuration>
<failOnViolation>true</failOnViolation> <!—will fail the build if
checkstyle violated -->
<enableRulesSummary>false</enableRulesSummary>
<configLocation>checkstyle-checker1.xml</configLocation> <!—Customized
checker xml located in the location of the pom.xml-->
</configuration>
</plugin>
</plugins>
</build>
If checkstyle doesn't work then use check
--
View this message in context: http://www.nabble.com/How-can-the-checkstyle-plugin-be-configured-to-fail-the-build--tp11235269p21936262.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