maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kalyan Akella" <kalyan.ake...@gmail.com>
Subject Re: Maven runs surefire plugin for testing by default. How to change this?
Date Thu, 01 Nov 2007 06:11:45 GMT
Hi Jason,

I corrected an error in my project POM (related to profiles) and hence now
maven invokes my test plugin during the test phase, as expected. However, as
I mentioned in my earlier mail, the usage of the maven.test.skip parameter
causes maven to skip the testCompile phase as well. See the logs below:

 [INFO] [resources:testResources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [compiler:testCompile]
[INFO] Not compiling test sources
[INFO] [surefire:test]
[INFO] Tests are skipped.
[INFO] [war:war]
[INFO] Exploding webapp...

As a result, my test-plugin isn't able to find any test classes to execute
and hence isn't doing anything. Is there a way to avoid this from happening.
(Also, due to certain constraints, I regret for not being able to share the
source code of my plugin for now.). Please help.

Thank you.
Kalyan.


On 11/1/07, Jason van Zyl <jason@maven.org> wrote:
>
> Send me your plugin and a sample project with tests and I'll take a
> look.
>
> On 31 Oct 07, at 5:20 PM 31 Oct 07, Kalyan Akella wrote:
>
> > Moreover, when I set the maven.skip.test to true, apart from not
> > invoking my
> > test plugin, maven, doesn't even compile the test sources as is
> > evident from
> > the following logs:
> >
> > [INFO] [resources:testResources]
> > [INFO] Using default encoding to copy filtered resources.
> > [INFO] [compiler:testCompile]
> > [INFO] Not compiling test sources
> > [INFO] [surefire:test]
> > [INFO] Tests are skipped.
> > [INFO] [war:war]
> > [INFO] Exploding webapp...
> >
> > This is an even bigger problem which means that even if I
> > eventually, get my
> > test plugin to work it doesn't find any test classes to execute! Is
> > this a
> > problem with Maven or my configuration. Please help.
> >
> > Thank you.
> > Kalyan
> >
> >
> > ---------- Forwarded message ----------
> > From: Kalyan Akella <kalyan.akella@gmail.com>
> > Date: Nov 1, 2007 5:30 AM
> > Subject: Re: Maven runs surefire plugin for testing by default. How to
> > change this?
> > To: Maven Developers List <dev@maven.apache.org>
> >
> >
> > 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 <jason@maven.org> 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 < jason@maven.org> 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 < brett@apache.org> wrote:
> >>>>>>
> >>>>>> I think you're looking for the surefire skip parameter - but
this
> >>>>>> question belongs on the users@maven.apache.org 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 - brett@apache.org
> >>>>>> Blog: http://www.devzuz.org/blogs/bporter/
> >>>>>>
> >>>>>>
> >>>>>>
> ---------------------------------------------------------------------
> >>>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >>>>>> For additional commands, e-mail: dev-help@maven.apache.org
> >>>>>>
> >>>>>>
> >>>>
> >>>> Thanks,
> >>>>
> >>>> Jason
> >>>>
> >>>> ----------------------------------------------------------
> >>>> Jason van Zyl
> >>>> Founder,  Apache Maven
> >>>> jason at sonatype dot com
> >>>> ----------------------------------------------------------
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >>>> For additional commands, e-mail: dev-help@maven.apache.org
> >>>>
> >>>>
> >>
> >> Thanks,
> >>
> >> Jason
> >>
> >> ----------------------------------------------------------
> >> Jason van Zyl
> >> Founder,  Apache Maven
> >> jason at sonatype dot com
> >> ----------------------------------------------------------
> >>
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: dev-help@maven.apache.org
> >>
> >>
>
> Thanks,
>
> Jason
>
> ----------------------------------------------------------
> Jason van Zyl
> Founder,  Apache Maven
> jason at sonatype dot com
> ----------------------------------------------------------
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message