简体   繁体   English

Maven故障安全:在其他目录中启动码头

[英]Maven failsafe: Start jetty in different directory

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: 我有一个带有不同模块的maven项目,其中一个包含我的Web服务容器,另一个包含我的集成测试,看起来像这样:

-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. 我想使用故障安全插件执行集成测试并在集成测试前的生命周期中启动码头服务器,但是我不知道如何在WebService目录中启动码头服务器。

I carry out the test by mvn clean install in the ProjectRoot directory. 我通过mvn clean install在ProjectRoot目录中进行测试。

I included this in the pom.xml on the top-level: 我将其包含在顶级的pom.xml中:

<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>

The path to the webapp can be configured like this: Webapp的路径可以这样配置:

        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <configuration>
                <webAppSourceDirectory>path/to/webapp</webAppSourceDirectory>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM