You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Sag <ds...@epo.org> on 2005/10/05 10:02:30 UTC

[m2] running checkstyle as part of a test

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 




 

Re: [m2] running checkstyle as part of a test

Posted by David Sag <ds...@epo.org>.
Hey Brett, fantastic - that works fine and now I think I have a better 
understanding of all those undocumented tags :-)

if i get a chance i'll write all this up as there is precious little 
documentation yet on these matters that i can find.  or rather the 
documentation I have found has been well out of date.

Kind regards,
Dave Sag 




 

Brett Porter <br...@gmail.com> wrote on 05/10/2005 10:25:39 AM:

> I'm not sure where that came from - I don't recall the checkstyle plugin
> earlier having a separate test goal.
> 
> This works:
> 
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-checkstyle-plugin</artifactId>
> <configuration>
> <failsOnError>true</failsOnError>
> </configuration>
> <!-- These are the lifecycle bindings -->
> <executions>
> <execution>
> <!-- Execute as part of the test phase -->
> <phase>test</phase>
> <goals>
> <!-- execute checkstyle:checkstyle -->
> <goal>checkstyle</goal>
> </goals>
> </execution>
> </executions>
> </plugin>
> 
> On 10/5/05, David Sag <ds...@epo.org> wrote:
> >
> >
> > 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
> >
> >
> >
> >
> >

Re: [m2] running checkstyle as part of a test

Posted by Brett Porter <br...@gmail.com>.
I'm not sure where that came from - I don't recall the checkstyle plugin
earlier having a separate test goal.

This works:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<failsOnError>true</failsOnError>
</configuration>
<!-- These are the lifecycle bindings -->
<executions>
<execution>
<!-- Execute as part of the test phase -->
<phase>test</phase>
<goals>
<!-- execute checkstyle:checkstyle -->
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>

On 10/5/05, David Sag <ds...@epo.org> wrote:
>
>
> 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
>
>
>
>
>