I think you're looking for the surefire skip parameter - but this question belongs on the [EMAIL PROTECTED] list. Please reply there if necessary.

Thanks,
Brett

On 30/10/2007, at 2:48 PM, Kalyan Akella wrote:

Hi,

Recently, I developed a Java-based maven plugin intended to run in the test phase of the maven build instead of the standard surefire-plugin. It has just one goal, 'test'. When I configured my project's POM to include my plugin for the testing phase and made sure the POM doesn't refernce surefire anywhere, maven still invokes the surefire:test goal during the test phase. Could someone please help me how to avoid maven running surefire plugin and
instead run mine.

Here are the details of my plugin POM and that of the Project POM:

Plugin POM:
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>sample.plugin</groupId>
    <artifactId>maven-sample-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <version>1.0</version>
    <name>My Sample Plugin</name>
    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
          <groupId>org.apache.maven</groupId>
          <artifactId>maven-artifact</artifactId>
          <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.4</version>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.5</source>
                        <target>1.5</target>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

Project POM:
<project>
    <modelVersion>4.0.0</modelVersion>
    <groupId>sample.project</groupId>
    <artifactId>hello</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>pom</packaging>
    <name>Hello World</name>
    <modules>
        <module>test</module>
    </modules>
    <profiles>
        <profile>
            <id>dev</id>
            <build>
                <filters>
                    <filter>${filters.dir}/dev-env.properties</filter>
                </filters>
                <plugins>
                    <plugin>
                        <groupId>sample.plugin</groupId>
                        <artifactId>maven-sample-plugin</artifactId>
                        <version>1.0</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <phase>test</phase>

<inherited>false</inherited>
                            </execution>
                        </executions>
                        <configuration>
                            <goalPrefix>nfs</goalPrefix>
                            <includes>
                                <param>.*Test.class</param>
                            </includes>
                            <excludes>
                                <param>.*Abstract.*Test.class</param>
                                <param>.*$.*.class</param>
                                <param>.*Poller.*.class</param>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>1.5</source>
                        <target>1.5</target>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>sample.plugin</groupId>
                    <artifactId>maven-sample-plugin</artifactId>
                    <version>1.0</version>
                    <executions>
                        <execution>
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <!--<goalPrefix>nfs</goalPrefix>-->
                        <includes>
                            <param>.*Test.class</param>
                        </includes>
                        <excludes>
                            <param>.*Abstract.*Test.class</param>
                            <param>.*$.*.class</param>
                        </excludes>
                    </configuration>
                </plugin>
<!-- Commented out maven-surefire-plugin
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.3</version>
                    <configuration>
                        <excludes>
                            <exclude>**/Abstract*Test.java</exclude>
<exclude>**/Abstract*TestCase.java</ exclude>
                            <exclude>**/Data*Poller*.java</exclude>
                            <exclude>**/*$*</exclude>
                        </excludes>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</ artifactId>
                    <configuration>
                        <showSuccess>false</showSuccess>
                    </configuration>
                    <version>2.0</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>report</goal>
                            </goals>
                            <phase>test</phase>
                        </execution>
                    </executions>
                </plugin>
-->
            </plugins>
        </pluginManagement>
    </build>
</project>

Moreover, I included the following annotations while coding this plugin:
@requiresDependencyResolution test
@phase test
@goal test

Please help me. Thank you.
Sincere Regards,
Kalyan.

--
Brett Porter - [EMAIL PROTECTED]
Blog: http://www.devzuz.org/blogs/bporter/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to