views:

52

answers:

2

I would like to start and stop jetty with maven.

This is my setup http://nopaste.info/61ef12198d.html

With mvn jetty:run my jetty starts locally but when I want to run jetty in test-phase with mvn -Pselenium test jetty doesn't run.

A: 

My guess would be that you would have to bind an execution of jetty:run to a phase that runs before test. My guess would be process-test-classes. See Maven Lifecycle Reference.

seanizer
and how should i start then? With mvn -Pselenium test?
Java-g
sure, that should do it. add the plugin execution to the profile, obviously
seanizer
oh how can i do that? sorry for this stupid question..
Java-g
see Pascal's answer. The configuration required can be found here: http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin (header: **Automatic execution of the plugin**)
seanizer
+1  A: 

The "Maven way" would be to run your Selenium tests during the integration-test phase and to start and stop Jetty respectively during the pre-integration-test and post-integration-test phases.

There are several ways to implement such a configuration, see Integration and Functional Testing with Maven 2.0 for one approach.

Pascal Thivent