7.4.2. Maven を使用した管理対象ドメインでのアプリケーションのデプロイ
以下の手順では、Maven を使用して管理対象ドメインで JBoss EAP の helloworld
クイックスタートをデプロイおよびアンデプロイする方法を示します。
JBoss EAP クイックスタートの詳細は、JBoss EAP Getting Started Guideの Using the Quickstart Examples を参照してください。
アプリケーションのデプロイ
管理対象ドメインでアプリケーションをデプロイする場合、アプリケーションをデプロイするサーバーグループを指定する必要があります。これは、Maven の pom.xml
ファイルで設定されます。
pom.xml
の以下の設定は WildFly Maven Plugin を初期化し、main-server-group
をアプリケーションがデプロイされるサーバーグループとして指定します。
<plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> <version>${version.wildfly.maven.plugin}</version> <configuration> <domain> <server-groups> <server-group>main-server-group</server-group> </server-groups> </domain> </configuration> </plugin>
helloworld
クイックスタートディレクトリーで以下の Maven コマンドを実行します。
$ mvn clean install wildfly:deploy
デプロイする Maven コマンドの実行後、ターミナルウインドウにはデプロイメントの成功を表す以下の出力が表示されます。
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.005 s [INFO] Finished at: 2016-09-02T14:36:17-04:00 [INFO] Final Memory: 21M/226M [INFO] ------------------------------------------------------------------------
アクティブなサーバーインスタンスのサーバーログでデプロイメントの成功を確認することもできます。
WFLYSRV0027: Starting deployment of "helloworld.war" (runtime-name: "helloworld.war") WFLYUT0021: Registered web context: /helloworld WFLYSRV0010: Deployed "helloworld.war" (runtime-name : "helloworld.war")
アプリケーションのアンデプロイ
helloworld
クイックスタートディレクトリーで以下の Maven コマンドを実行します。
$ mvn wildfly:undeploy
アンデプロイする Maven コマンドの実行後、ターミナルウインドウにはアンデプロイメントの成功を表す以下の出力が表示されます。
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.750 s [INFO] Finished at: 2016-09-02T14:45:10-04:00 [INFO] Final Memory: 10M/184M [INFO] ------------------------------------------------------------------------
アクティブなサーバーインスタンスのサーバーログでアンデプロイメントの成功を確認することもできます。
WFLYUT0022: Unregistered web context: /helloworld WFLYSRV0028: Stopped deployment helloworld.war (runtime-name: helloworld.war) in 106ms WFLYSRV0009: Undeployed "helloworld.war" (runtime-name: "helloworld.war")