mentby.com
Blog | Jobs | Help | Signup | Login

maven antrun plugin 1.7 ignores second execution



Hello,

I have problems getting my second antrun target to run.

Below is the plugin configuration I use. Its purpose is to start an Apache
httpd server before integration tests and kill it later. The executables
and folders are set profile and os specific. The first execution I can see
in the maven log, and in target/antrun there is a build-main.xml created
that matches the target of the first execution. However the second
execution never appears in the log nor is a file created for it. What am I
missing here?

Cheers,
Kai

http://pastebin.com/JhpA0vaY

   1.             <plugin>
   2.                 <artifactId>maven-antrun-plugin</artifactId>
   3.                 <version>1.7</version>
   4.                 <executions>
   5.                     <execution>
   6.                         <id>Starting Apache</id>
   7.                         <phase>pre-integration-test</phase>
   8.                         <goals>
   9.                             <goal>run</goal>
   10.                         </goals>
   11.                         <configuration>
   12.                             <target name="Starting Apache">
   13.                                 <echo>Starting Apache httpd:</echo>
   14.                                 <exec executabl   "${apache.home}/${apache.executable}" spawn="true">
   15.                                     <arg value="-f" />
   16.                                     <arg valu   "${project.build.directory}/httpd.conf" />
   17.                                 </exec>
   18.                             </target>
   19.                         </configuration>
   20.                     </execution>
   21.                     <execution>
   22.                         <id>Stopping Apache</id>
   23.                         <phase>post-integration-test</phase>
   24.                         <goals>
   25.                             <goal>run</goal>
   26.                         </goals>
   27.                         <configuration>
   28.                             <target name="Stopping Apache">
   29.                                 <echo>Stopping Apache httpd:</echo>
   30.                                 <loadfile property="PID" srcFil   "${project.build.directory}/httpd.pid" />
   31.                                 <exec executable="${kill.executable}"
    failonerror="true">
   32.                                     <arg value="${kill.arguments}" />
   33.                                     <arg value="${PID}" />
   34.                                 </exec>
   35.                             </target>
   36.                         </configuration>
   37.                     </execution>
   38.                 </executions>
   39.             </plugin>
   *
   *


Kai Hackemesser Thu, 23 Feb 2012 15:26:23 -0800

What command are you executing? "mvn ..."

PS Here's a hint into why this probably isn't working... review the lifecycle: http://maven.apache.org/guides/introduction/introduction-to-[..]

Wayne


Wayne Fay Fri, 24 Feb 2012 06:59:43 -0800

mvn integration-test.
Wait. I think I got it. Will try Monday at work.

Cheers,
Kai


Kai Hackemesser Fri, 24 Feb 2012 16:57:07 -0800

I heard back from Kai over the weekend and wanted to make sure this
made it back to the list for future Google and Nabble searchers...

######
Ok, tested it now, was absolutely my fault. If I want the
post-integration-test phase to run it is not sufficient to call 'mvn
integration-test', use 'mvn verify' instead.

Cheers,
Kai
######


Wayne Fay Mon, 27 Feb 2012 08:03:42 -0800



Post a Comment