7.4. Maven を使用したアプリケーションのデプロイ
Apache Maven を使用してアプリケーションをデプロイすると、JBoss EAP へのデプロイメントを簡単に既存の開発ワークフローに取り入れることができます。
アプリケーションをアプリケーションサーバーにデプロイおよびアンデプロイする簡単な操作を提供する WildFly Maven Plugin を使用すると、Maven を使用してアプリケーションを JBoss EAP にデプロイできます。
7.4.1. Maven を使用したアプリケーションのスタンドアロンサーバーへのデプロイ
以下の手順では、Maven を使用して JBoss EAP の helloworld
クイックスタートをスタンドアロンサーバーにデプロイおよびアンデプロイする方法を示します。
JBoss EAP クイックスタートの詳細は、JBoss EAP Getting Started Guideの Using the Quickstart Examples を参照してください。
アプリケーションのデプロイ
Maven pom.xml
ファイルで WildFly Maven Plugin を初期化します。これは、JBoss EAP クイックスタートの pom.xml
ファイルで設定されているはずです。
<plugin> <groupId>org.wildfly.plugins</groupId> <artifactId>wildfly-maven-plugin</artifactId> <version>${version.wildfly.maven.plugin}</version> </plugin>
helloworld
クイックスタートディレクトリーで以下の Maven コマンドを実行します。
$ mvn clean install wildfly:deploy
デプロイする Maven コマンドの実行後、ターミナルウインドウにはデプロイメントの成功を表す以下の出力が表示されます。
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.981 s [INFO] Finished at: 2015-12-23T15:06:13-05:00 [INFO] Final Memory: 21M/231M [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.237 s [INFO] Finished at: 2015-12-23T15:09:10-05:00 [INFO] Final Memory: 10M/183M [INFO] ------------------------------------------------------------------------
アクティブなサーバーインスタンスのサーバーログでアンデプロイメントの成功を確認することもできます。
WFLYUT0022: Unregistered web context: /helloworld WFLYSRV0028: Stopped deployment helloworld.war (runtime-name: helloworld.war) in 27ms WFLYSRV0009: Undeployed "helloworld.war" (runtime-name: "helloworld.war")