views:

188

answers:

2

I have two set of integration tests in one maven project - automatic and manual tests. The manual tests are few but tedious - they require pulling the plug of servers etc. I would like to create a separate goal for the manual tests, so i can run something like mvn manualtests to run the manual tests. If you just run a normal maven build mvn install or so, the automatic tests should be run.

I've already annotated the manual tests with the TestNG annotation @Test(groups="manual". The goal is now to have two configurations of the surefire plugin, one running the automatic tests which is bound to the test phase of the build, and one running the manual tests which is bound to another custom phase that I would like to call manualtests. It seems as if it is not possible to bind an execution of a plugin to a nonexistent phase (i.e one which isn't predefined by maven). Is it not possible to define your own phases?

A: 

That should be possible, though not easy. First step: look at how it's done by default.

use this dependency:

<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-core</artifactId>
    <version>${maven.version}</version>
</dependency>

get the sources and have a look at the components.xml inside META-INF/plexus. there, both the default phases and the default lifecycle / phase bindings are defined.

create a plugin that overrides these default phases (in it's own components.xml) and define it as an extension

seanizer
not easy at all... maybe one could make a plugin which would dynamically add the lifecycles based on the plugin config. I will look into it.
disown
A: 

You might be able to use profiles for that: http://maven.apache.org/guides/introduction/introduction-to-profiles.html

Nightscape