I am trying to configure my pom to run the checkstyle plugin when i run the tests.
Initially I tried putting this in my POM based on a tutorial I read at http://www.devx.com/Java/Article/28801
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<propertiesFile>checkstyle-src.xml</propertiesFile>
<failsOnError>true</failsOnError>
</configuration>
<goals>
<goal>
<id>test</id>
</goal>
</goals>
</plugin>
</plugins>
</build>
bu that gave me a warnign that the goals needed to be places within an executions block and anything else had been deprectaed.
so a bit of digging turned up
http://marc.theaimsgroup.com/?l=turbine-maven-user&m=112064009313457&w=2
with the suggestion that I arrange my pom.xml more like this:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<propertiesFile>checkstyle-src.xml</propertiesFile>
<failsOnError>true</failsOnError>
</configuration>
<executions>
<execution>
<goals>
<goal>Test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
but this results in
[ERROR] FATAL ERROR
[INFO] ----------------------------------------------------------------------------
[INFO] Diagnosis: Goal from the POM 'Test' was not found in the plugin
there is a JIRA issue that claims the POM XSD and the docs and the code are all out of sync.
http://jira.codehaus.org/browse/MNG-555
so I am left wondering what to do about this... (note i also tried goal names 'test' and 'test:test'
I just tried updating to beta 3 today and generating a clean POM with the archetype command but it still references the old - broken XSD file.
has anyone got this to work? if so a working example would be very much appreciated.
Kind regards,
Dave Sag
- [m2] running checkstyle as part of a test David Sag
- Re: [m2] running checkstyle as part of a test Brett Porter