【发布时间】:2014-09-25 21:52:56
【问题描述】:
我正在尝试使用 Maven Cargo 插件为我的项目的集成测试启动一个嵌入式 Jetty 容器。使用 Jetty 托管的 Web 应用程序需要传递一个指向其配置文件的 Java 系统属性。如何让它与 Cargo 一起使用?
我已经尝试了插件cargo.jvmargs 设置,但它似乎不起作用:
<plugin>
<!-- Launch an embedded Jetty instance hosting this project's WAR (as
well as the rps-tourney-service-app WAR it depends on) prior to running this
project's integration tests, and stop it after the integration tests. Alternatively,
for manual testing, manually run 'mvn cargo:run' to start the Jetty server,
and have Cargo wait for a 'ctrl+c' command to stop it. -->
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>start-container</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<container>
<containerId>jetty9x</containerId>
<type>embedded</type>
</container>
<configuration>
<properties>
<cargo.servlet.port>9093</cargo.servlet.port>
<cargo.jvmargs>-Drps.service.config.path=${project.build.testOutputDirectory}/rps-service-config-its.xml
-Drps.webapp.config.path=${project.build.testOutputDirectory}/rps-webapp-config-its.xml</cargo.jvmargs>
</properties>
</configuration>
<deployables>
<deployable>
<!-- The web service WAR for the application. -->
<groupId>com.justdavis.karl.rpstourney</groupId>
<artifactId>rps-tourney-service-app</artifactId>
<type>war</type>
<properties>
<context>/rps-tourney-service-app</context>
</properties>
</deployable>
<deployable>
<!-- The end-user web site WAR for the application. As this is the
current project, Cargo binds the artifact automatically. All that needs to
be done here is to configure the context path. -->
<properties>
<context>/rps-tourney-webapp</context>
</properties>
</deployable>
</deployables>
</configuration>
</plugin>
webapps 按预期启动,但随后由于未找到预期的配置属性而死。
【问题讨论】:
标签: maven jetty embedded-jetty cargo