2012-03-29 8 views
3

maven-jetty-pluginを使ってWebアプリケーションの統合テストを書いています。私は、事前統合テスト段階で展開戦目標を使用しています。 Webアプリケーションは、同じ桟橋のインスタンスから静的コンテンツを提供することによって模擬したい別のWebアプリケーションに依存しています。maven-jetty-pluginをdeploy-warにして外部の静的コンテンツを同時に配信する

ここに私の桟橋の設定の関連部分です:

<execution> 
    <id>start-jetty</id> 
    <phase>pre-integration-test</phase> 
    <goals> 
     <goal>deploy-war</goal> 
    </goals> 
    <configuration> 
     <connectors> 
      <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> 
       <port>${jetty.port}</port> 
      </connector> 
     </connectors> 
     <daemon>true</daemon> 
     <webApp>${build.directory}/motown2-war.war</webApp> 
     <webAppConfig> 
      <extraClasspath>${basedir}/target/classes/;${basedir}/target/test-classes</extraClasspath> 
      <contextPath>/${context.path}</contextPath> 
     </webAppConfig> 
     <contextHandlers>   
      <contextHandler implementation="org.mortbay.jetty.webapp.WebAppContext"> 
       <contextPath>/other</contextPath> 
       <resourceBase>/opt/data</resourceBase> 
      </contextHandler> 
     </contextHandlers> 
    </configuration> 
</execution> 

私は http://blog.markfeeney.com/2009/12/scala-lift-jetty-6-static-content-and.html上でこの設定、 をベースとしましたが、コンテキストハンドラの設定を無視しているようです。私は ログファイル内のこれのトレースを見つけることができませんjettyは静的 コンテンツの代わりに404を返し、Webアプリケーション自体が実行されています。

私には何が欠けていますか?

答えて

1

私はそれを考え出した:

をresourceHandlers構成のみ桟橋の作品:実行目標を、私は今 が にWebアプリケーションをオーバーレイをテストすることが私のテストプロジェクト、中空のWebアプリケーションで働いています:

<execution> 
    <id>start-jetty</id> 
    <phase>pre-integration-test</phase> 
    <goals> 
     <goal>run</goal> 
    </goals> 
    <configuration> 
     <connectors> 
      <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector"> 
       <port>${jetty.port}</port> 
      </connector> 
     </connectors> 
     <daemon>true</daemon> 
     <webApp>${build.directory}/motown2-war.war</webApp> 
     <webAppConfig> 
      <extraClasspath>${basedir}/target/classes/;${basedir}/target/test-classes</extraClasspath> 
      <contextPath>/${context.path}</contextPath> 
      <baseResource implementation="org.mortbay.resource.ResourceCollection"> 
       <resourcesAsCSV>../motown2-war/src/main/webapp,src/main/webapp</resourcesAsCSV> 
      </baseResource> 
     </webAppConfig> 
     <contextHandlers>   
      <contextHandler implementation="org.mortbay.jetty.webapp.WebAppContext"> 
       <contextPath>/other</contextPath> 
       <resourceBase>/opt/data</resourceBase> 
      </contextHandler> 
     </contextHandlers> 
    </configuration> 
</execution> 
+0

必要なサーブレットのバージョンに応じて、jetty 7またはjetty 8のorg.mortbay.jetty:jetty-maven-pluginに更新します。 6日間の桟橋以来、かなりの量の開発が行われています。 –

関連する問題