If the phase is undefined, then the goal does not execute! (i.e. if I remove @phase verify from the verify mojo, then maven does not blow up and does not execute the verify goal)
2009/5/22 Brian Fox <[email protected]> > Feature or bug aside, I would probably not configure my pom that way, it > masks the fact that they run in either separate or potentially undefined > phases. (if they aren't separate, then which one would it pick?) > > > On Fri, May 22, 2009 at 10:51 AM, Stephen Connolly < > [email protected]> wrote: > >> >> >> 2009/5/22 Stephen Connolly <[email protected]> >> >> OK, I just noticed this... >>> >>> If I have two mojo's annotated with different phases, i.e. >>> >>> /** >>> * @goal integration-test >>> * @requiresProject true >>> * @requiresDependencyResolution test >>> * @phase integration-test >>> */ >>> public class FailsafeMojo >>> extends AbstractMojo >>> { >>> ... >>> } >>> >>> and >>> >>> /** >>> * @goal verify >>> * @requiresProject true >>> * @requiresDependencyResolution test >>> * @phase verify >>> */ >>> public class VerifyMojo >>> extends AbstractMojo >>> { >>> ... >>> } >>> >>> >>> If I add to my pom.xml >>> >>> <project> >>> .. >>> <build> >>> .. >>> <plugins> >>> ... >>> <plugin> >>> <groupId>....</groupId> >>> <artifactId>....</artifactId> >>> <version>...</version> >>> ... >>> * <executions> >>> <execution> >>> <goals> >>> <goal>integration-test</goal> >>> <goal>verify</goal> >>> </goals> >>> </execution> >>> </executions> >>> * </plugin> >>> ... >>> </plugins> >>> ... >>> </build> >>> </project> >>> >>> Then the integration-test goal is bound to the integration-test phase and >>> the verify goal is bound to the verify phase. >>> >>> My question is this... is this a feature or a bug? >>> >>> It'd be nice if it was a feature... but I suspect it is a bug... >>> >>> Just to confirm for everyone... >>> >>> If I add >>> >>> <project> >>> .. >>> <build> >>> .. >>> <plugins> >>> ... >>> <plugin> >>> <groupId>....</groupId> >>> <artifactId>....</artifactId> >>> <version>...</version> >>> ... >>> * <executions> >>> <execution> >>> <phase>integration-test</phase> >>> <goals> >>> <goal>integration-test</goal> >>> <goal>verify</goal> >>> </goals> >>> </execution> >>> </executions> >>> * </plugin> >>> ... >>> </plugins> >>> ... >>> </build> >>> </project> >>> >>> Then both goals are bound to the integration-test phase, as I would >>> expect >>> >>> -Stephen >> >> >> <plugins> >> <plugin> >> <groupId>org.mortbay.jetty</groupId> >> <artifactId>maven-jetty-plugin</artifactId> >> <version>6.1.16</version> >> <configuration> >> <stopPort>${integration-test-stop-port}</stopPort> >> <stopKey>STOP</stopKey> >> <contextPath>/</contextPath> >> </configuration> >> <executions> >> <execution> >> <id>start-jetty</id> >> <phase>pre-integration-test</phase> >> <goals> >> <!-- stop any previous instance to free up the port --> >> <goal>stop</goal> >> <goal>run-exploded</goal> >> </goals> >> <configuration> >> <scanIntervalSeconds>0</scanIntervalSeconds> >> <daemon>true</daemon> >> </configuration> >> </execution> >> <execution> >> <id>stop-jetty</id> >> <phase>post-integration-test</phase> >> <goals> >> <goal>stop</goal> >> </goals> >> </execution> >> </executions> >> </plugin> >> <plugin> >> <groupId>@project.groupId@</groupId> >> <artifactId>@project.artifactId@</artifactId> >> <version>@project.version@</version> >> <executions> >> <execution> >> <goals> >> <goal>integration-test</goal> >> <goal>verify</goal> >> </goals> >> </execution> >> </executions> >> </plugin> >> >> gives: >> >> ... >> [INFO] [INFO]* [jetty:run-exploded {execution: start-jetty}]* >> [INFO] [INFO] Configuring Jetty for project: run failing tests in jetty >> container >> [INFO] 2009-05-22 15:48:35.834::INFO: Logging to STDERR via >> org.mortbay.log.StdErrLog >> [INFO] [INFO] Context path = / >> [INFO] [INFO] Tmp directory = determined at runtime >> [INFO] [INFO] Web defaults = org/mortbay/jetty/webapp/webdefault.xml >> [INFO] [INFO] Web overrides = none >> [INFO] [INFO] Starting jetty 6.1.16 ... >> [INFO] 2009-05-22 15:48:35.906::INFO: jetty-6.1.16 >> [INFO] 2009-05-22 15:48:35.999::INFO: No Transaction manager found - if >> your webapp requires one, please configure one. >> [INFO] 2009-05-22 15:48:36.170::INFO: Started >> [email protected]:8080 >> [INFO] [INFO] Started Jetty Server >> [INFO] [INFO] *[failsafe:integration-test {execution: default}]* >> [INFO] [INFO] Failsafe report directory: >> /home/connollys/src/mojo-sandbox/failsafe-maven-plugin/target/it/jetty-war-test-failing/target/failsafe-reports >> [INFO] >> [INFO] ------------------------------------------------------- >> [INFO] T E S T S >> [INFO] ------------------------------------------------------- >> [INFO] Running basic.BasicIT >> [INFO] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: >> 0.896 sec <<< FAILURE! >> [INFO] >> [INFO] Results : >> [INFO] >> [INFO] Failed tests: >> [INFO] testSmokes(basic.BasicIT) >> [INFO] >> [INFO] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 >> [INFO] >> [INFO] [INFO] *[jetty:stop {execution: stop-jetty}]* >> [INFO] [INFO] Stopping server 0 >> [INFO] [INFO]* [failsafe:verify {execution: default}]* >> [INFO] [INFO] Failsafe report directory: >> /home/connollys/src/mojo-sandbox/failsafe-maven-plugin/target/it/jetty-war-test-failing/target/failsafe-reports >> [INFO] [INFO] >> ------------------------------------------------------------------------ >> [INFO] [ERROR] BUILD FAILURE >> [INFO] [INFO] >> ------------------------------------------------------------------------ >> [INFO] [INFO] There are test failures. >> [INFO] >> >> >> >> >
