2012-02-14 10 views
3

私は以下のユースケースを持っています: Spring WSで実装されたWebサービスを使用してSpring MVCで実装されたWebアプリケーションがあります。2つのアプリケーションをデプロイするmaven-embedded-glassfish-plugin

プロジェクトはビルドツールとしてmavenを使用しています。 今、Webアプリケーションの統合テストを実装したいと思います。 これはmaven-embedded-glassfish-pluginを使用したいと思っています。 は私がのpom.xmlに以下のMavenの構成を有している:

<plugin> 
    <groupId>org.glassfish</groupId> 
    <artifactId>maven-embedded-glassfish-plugin</artifactId> 
     <version>3.1.1</version> 
     <configuration> 
      <goalPrefix>embedded-glassfish</goalPrefix> 
      <app>${basedir}/target/web-app.war</app> 

      <autoDelete>true</autoDelete> 
      <port>8080</port> 
      <name>web-app</name> 

      <configFile>src/test/resources/glassfish/domain.xml</configFile> 
     </configuration> 

     <executions> 
      <execution> 
       <id>start-glassfish</id> 
       <phase>pre-integration-test</phase> 
       <goals> 
       <goal>start</goal> 
       </goals> 
      </execution> 
      <execution> 
       <id>glassfish-deploy</id> 
       <phase>pre-integration-test</phase> 
       <goals> 
       <goal>deploy</goal> 
       </goals> 
      </execution> 
      <execution> 
       <id>glassfish-undeploy</id> 
       <phase>post-integration-test</phase> 
       <goals> 
       <goal>undeploy</goal> 
       </goals> 
      </execution> 
      <execution> 
       <id>stop-glassfish</id> 
       <phase>post-integration-test</phase> 
       <goals> 
       <goal>stop</goal> 
       </goals> 
      </execution> 
     </executions> 
     </plugin> 

すべてが正常に動作します。 しかし、私はwebservice.warファイルの配備を追加する必要があります。 これは私のポームの依存関係ではありません。 web-app.warアプリケーションで定義されたWebサービスを呼び出すためのスタブクラスのみを持っています。

この2番目のアプリケーションをどのように配備するのがいいですか?

私は自動的に何かになりたいのですが、おそらくmavenリポジトリを使用しています。私が修正を加えると自動的に新しいバージョンのWebサービスを使いたいのです。

答えて

3

私は[email protected]の助けとミスターBhavani Shankarので、次の解決策を見つける:あなたが戦争の達人に依存関係を設定し、展開することができます

<execution> 
     <id>glassfish-additional_deployments</id> 
     <phase>pre-integration-test</phase> 
     <goals> 
     <goal>admin</goal> 
     </goals> 
     <configuration> 
     <commands> 
      <param>deploy ${basedir}/src/test/resources/integrationtest/app-ws.war</param> 
     </commands> 
     </configuration> 
    </execution> 

Teoreticallyをlibディレクトリからwarファイルも削除します。このプラグインについての興味深い

何か、誰かがオプションを使用する場合のみ:既存のGlassFishのインストールを

<instanceRoot>${project.build.directory}/glassfish</instanceRoot> 

はバージョン3.1.1で動作していないが。 あなたは(のGlassFishのインストールされていなくても)を使用し、このプロパティを設定する場合:、あなただけ「のglassfishを設定する必要が

 <systemProperties> 
     <property>glassfish.embedded.tmpdir=target/glassfish</property> 
     </systemProperties> 
0

のmaven-組み込みのGlassFish - プラグインの3.1.1バージョンのために。埋め込み.tmpdir "プロパティに静的値(Windows OSの場合は、私はLinuxのためには分かりません)。 mavenはパスを変換できないためです。

私はグラスフィッシュに耳を配置しており、それは私のために完全に働いています。

<plugin> 
      <groupId>org.glassfish</groupId> 
      <artifactId>maven-embedded-glassfish-plugin</artifactId> 
      <version>3.1.1</version> 
      <configuration> 
       <systemProperties> 
        <property>glassfish.embedded.tmpdir=target/glassfish</property> 
       </systemProperties> 
       <app>${project.build.directory}/${build.finalName}.ear</app> 
       <autoDelete>true</autoDelete> 
       <port>8080</port> 
       <contextRoot>test</contextRoot> 
      </configuration> 
      <executions> 
       <execution> 
        <id>start-glassfish</id> 
        <phase>install</phase> 
        <goals> 
         <goal>run</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

しかし、私は<property>glassfish.embedded.tmpdir=target/glassfish</property>

部分を除去し、その後、それはゆっくりとプロジェクトをロードしているし、それが安定していないサーバを起動した場合、それは本当に面白いです:

私の設定があります。

関連する問題