ジョン、私は同じことをしていますが、Jetty プラグインでは別のアプローチを取りました。最終結果は同じだと思います。いくつかの Web サービス WAR に対して実行する統合テスト スイートを開発しています。フェーズで使用dependency:copy
してから、次のように構成された のリストを使用しています。package
<contextHandler/>
maven-jetty-plugin
<project>
…
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-wars</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/wars-to-be-tested</outputDirectory>
<stripVersion>true</stripVersion>
<artifactItems>
…
<artifactItem>
<groupId>groupId</groupId>
<artifactId>artifactId</artifactId>
<version>version</version>
<type>war</type>
</artifactItem>
…
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.1.3.v20100526</version>
<configuration>
…
<contextHandlers>
…
<contextHandler implementation="org.mortbay.jetty.plugin.JettyWebAppContext">
<war>${project.build.directory}/wars-to-be-tested/artifactId.war</war>
<contextPath>/context</contextPath>
</contextHandler>
</contextHandlers>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>stop</goal>
<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>
</plugins>
</build>
</project>
さまざまな戦争を依存関係として宣言し、それを使用してディレクトリdependency:copy-dependencies
を設定することをお勧めします。wars-to-be-tested
これにより、Maven リアクターは、テストする戦争の後に統合テスト モジュールを構築する必要があることを理解できるようになります。私が遭遇した問題は、Jetty プラグインが、依存関係としてリストされているすべての war を「オーバーレイ」したいと考えていたことです (この概念は、実際に起こるまで聞いたこともありませんでした)。それが起こるのを許すことが何かを害するかどうかはわかりませんが、私はそれが好きではなかったので、私はそのdependency:copy
方法を採用しました.
これは Cargo を使用するための単なる代替手段です。私はそれを自分で調べますが、別の方法を提供したかっただけです。