Maven – WebアプリケーションをWildFlyにデプロイする
Mavenでは、公式のJBoss
WildFly Maven Plugin
を使用して、Webアプリケーション(warファイル)をWildFlyアプリケーションサーバーにデプロイすることができます。
テストされた技術:
-
Maven 3.3.9
-
WildFly 9.0.2.final
-
WildFly Maven Plugin 1.1.0.Alpha5
__P.Sこのデプロイメントテストには、//spring-mvc/spring-4-mvc-ajax-hello-world-example/[Spring MVC Webアプリケーション]が使用されます。
1. WARをWildFlyに展開する
1.1 WildFlyをスタンドアロンモードで起動します。
$ ./wildfly-9.0.2.Final/bin/standalone.sh ========================================================================= JBoss Bootstrap Environment JBOSS__HOME:/home/mkyong/Desktop/wildfly-9.0.2.Final JAVA:/opt/jdk/jdk1.8.0__66/bin/java ... Http management interface listening on http://127.0.0.1:9990/management ... Admin console listening on http://127.0.0.1:9990 ... WildFly Full 9.0.2.Final (WildFly Core 1.0.2.Final) started in 2260ms ...
1.2 Declares
wildfly-maven-plugin
in the
pom.xml
file.
pom.xml
<plugin> <groupId> org.wildfly.plugins </groupId> <artifactId> wildfly-maven-plugin </artifactId> <version> 1.1.0.Alpha5 </version> </plugin>
1.3 `mvn wildfly:deploy`でデプロイする
ワイルドフラリーターミナル
... ... WFLYUT0021: Registered web context:/spring4-mvc-maven-ajax-example-1.0-SNAPSHOT ... WFLYSRV0010: Deployed "spring4-mvc-maven-ajax-example-1.0-SNAPSHOT.war" (runtime-name : "spring4-mvc-maven-ajax-example-1.0-SNAPSHOT.war")
1.4 `maven wildfly:undeploy`でデプロイする
ワイルドフラリーターミナル
... ... WFLYSRV0028: Stopped deployment spring4-mvc-maven-ajax-example-1.0-SNAPSHOT.war ... (runtime-name: spring4-mvc-maven-ajax-example-1.0-SNAPSHOT.war) in 50ms ... WFLYDR0002: Content removed from location/home/mkyong/Desktop/wildfly-9.0.2.Final/... standalone/data/content/94/c65382716f33f1c7e506208ed21616815438b2/content ... WFLYSRV0009: Undeployed "spring4-mvc-maven-ajax-example-1.0-SNAPSHOT.war" ... (runtime-name: "spring4-mvc-maven-ajax-example-1.0-SNAPSHOT.war")
2. Update web context
By default, the filename of the
war
file (in target folder) will be
registered as the web context. To custom it, define a deployment name by
configure the
name
option like this :
pom.xml
<plugin> <groupId> org.wildfly.plugins </groupId> <artifactId> wildfly-maven-plugin </artifactId> <version> 1.1.0.Alpha5 </version> <構成> <hostname> 127.0.0.1 </hostname> <port> 9990 </port> <username> mkyong </username> <password>パスワード</password> <name> spring4ajax.war </name> </configuration> </plugin>
上記の設定では、 `spring4ajax`が新しいwebになります
コンテキストパス –
http://localhst:8080/spring4ajax
===参考文献
。
WildFly
Maven Plugin
。リンク://spring-mvc/spring-4-mvc-ajax-hello-world-example/[Spring 4 MVC
Ajax Hello Worldの例]
maven
maven plugin
wildfly