I have included the following annotations (in the Javadoc comments) inside
my plugin class:
@phase test
@goal test
And, in the main project POM, I am calling my plugin this way,
<project>
...
<profiles>
<profile>
...
<plugins>
<plugin>
<groupId>sample.plugin</groupId>
<artifactId>maven-sample-plugin</artifactId>
<version>1.0</version>
<!-- The following section should be redundant as the annontations in the
plugin class should take case of phase & goal-->
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
<phase>test</phase>
<inherited>false</inherited>
</execution>
</executions>
<configuration>
<includes>
<param>.*Test.class</param>
</includes>
<excludes>
<param>.*Abstract.* Test.class</param>
<param>.*$.*.class</param>
<param>.*Poller.*.class</param>
</excludes>
</configuration>
</plugin>
</plugins>
............
Still, Maven doesn't invoke my test plugin during the test phase. Could you
please help.
Thank you.
Kalyan.
On 10/31/07, Jason van Zyl <[EMAIL PROTECTED]> wrote:
>
>
> On 31 Oct 07, at 6:57 AM 31 Oct 07, Kalyan Akella wrote:
>
> > Hi Jason,
> >
> > Thank you for the response. However, even after setting the
> > maven.skip.testparameter to 'true' in my main POM, the maven build
> > cycle doesn't still
> > invoke my plugin in the testing phase. It simply skips the
> > surefire:test
> > phase and proceeds to the consequent phases. Is there anything I am
> > missing
> > in my plugin-configuration. Please help me.
> >
>
> If you're developing a plugin you have to make sure your plugin is
> setup to run in the test phase, and you also need to configure it in
> your POM to run. You've done these things and you can't get your
> plugin to run in the test phase?
>
> > Thank you.
> > Kalyan.
> >
> >
> > On 10/31/07, Jason van Zyl <[EMAIL PROTECTED]> wrote:
> >>
> >>
> >> On 30 Oct 07, at 1:06 AM 30 Oct 07, Kalyan Akella wrote:
> >>
> >>> Hi Brett,
> >>>
> >>> Thanks for the response. However, the skip parameter
> >>> (maven.test.skip) skips
> >>> running tests itself. Morever, it is only consumed by the surefire
> >>> plugin.
> >>
> >> Surefire is baked into the default lifecycle, you will currently need
> >> to configure Surefire to skip so that you can use your own plugin in
> >> its place. We know override the baked in plugins is a pain, but you
> >> can work around this case by just shutting off Surefire with a
> >> configuration and then using your.
> >>
> >>> I
> >>> dont want surefire to show up at all during the test phase. I need
> >>> my plugin
> >>> to take control of the test phase instead of the surefire plugin. I
> >>> shall
> >>> also post this message to the users list as well.
> >>>
> >>
> >> You can't knock out Surefire without hacking our default lifecycle
> >> execution so you're stuck with the skip parameter with Surefire so
> >> that only your test plugin will run. This is something we definitely
> >> need to fix as many people are just interested in setting their own,
> >> say a simple TestNG plugin, and not have to use Surefire at all.
> >> Right
> >> now you're forced to use Surefire.
> >>
> >>> Thanks,
> >>> Kalyan
> >>>
> >>>
> >>> On 10/30/07, Brett Porter <[EMAIL PROTECTED]> wrote:
> >>>>
> >>>> 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]
> >>>>
> >>>>
> >>
> >> Thanks,
> >>
> >> Jason
> >>
> >> ----------------------------------------------------------
> >> Jason van Zyl
> >> Founder, Apache Maven
> >> jason at sonatype dot com
> >> ----------------------------------------------------------
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder, Apache Maven
> jason at sonatype dot com
> ----------------------------------------------------------
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>