0

I have a maven project with different modules, one of them containing my web services container, another containing my integration tests looking something like this:

-ProjectRoot
--[...]
--WebService
--IntegrationTests

I would like to use the failsafe plugin to carry out the integration tests and start the jetty server in the pre-integration-test life cycle, but I can't figure out how to start the jetty server inside the WebService directory.

I carry out the test by mvn clean install in the ProjectRoot directory.

I included this in the pom.xml on the top-level:

<plugin>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>${jetty.version}</version>
    <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <stopPort>8005</stopPort>
        <stopKey>STOP</stopKey>
        <stopWait>10</stopWait>
    </configuration>
    <executions>
        <execution>
            <id>start-jetty</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>run</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>
Malik Atalla
  • 193
  • 8
  • Why would you like to start jetty in the webservice directory and is this directory the location of your module? integration test phase is after the packaging phase which means you have your `war` artifacts already being produces. Can you describe more in detail where you are located show the full pom of your project and show what exactly does not work? – khmarbaise Aug 15 '14 at 06:40
  • In that case how do I tell the Jetty server where to find the war? – Malik Atalla Aug 15 '14 at 15:52

1 Answers1

0

The path to the webapp can be configured like this:

        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <configuration>
                <webAppSourceDirectory>path/to/webapp</webAppSourceDirectory>
Malik Atalla
  • 193
  • 8