maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From E S <electric.or.sh...@gmail.com>
Subject Plugin running at the wrong time
Date Wed, 02 Feb 2011 05:13:26 GMT
I have a maven project consisting of a top level pom and several child poms
under it. Each child project has a set of units tests that are output by
surefire. I have written a custom plugin that will combine the results of
all the sub-projects unit tests into a single file to be fed into our build
server. I would like for this plugin to be run during the package phase of
the top level build. The idea is that all the projects run their tests and
output their surefire reports during the test phase and then after that is
done, my plugin consolidates them during the package phase. In order to do
this, I have added the a reference to plugin to the top level pom file's
build section like this:

<build>
   <finalName>whatever</finalName>
   <plugins>
      <plugin>
         <groupId>my.plugin.group</groupId>
         <artifactId>consolidator</artifactId>
         <version>1.0-SNAPSHOT</version>
         <inherited>false</inherited>
         <executions>
            <execution>
               <id>execution1</id>
               <phase>package</phase>
               <goals>
                  <goal>junit</goal>
               </goals>
               <configuration>
                  <rootDir>${basedir}</rootDir>
                  <outFile>${basedir}/testresults.xml</outFile>
               </configuration>
            </execution>
         </executions>
      </plugin>
   </plugins>
</build>

The problem is that when I run the build, the consolidator plugin runs way
before the unit tests have gotten a chance to run. It's almost the first
thing that gets run during the build. I can't figure out why this would
happen. I have clearly designated it to run during the package phase. In
fact, when I use the plugin directly inside one of the sub-projects (just to
see if it would work) it runs at the correct time. What is different about
the top level pom?

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