Maven - Déployez une application Web sur WildFly
Dans Maven, nous pouvons utiliser les JBossWildFly Maven Pluginofficiels pour déployer une application Web (fichier war) sur le serveur d'applications WildFly.
Technologies testées:
-
Maven 3.3.9
-
WildFly 9.0.2.finale
-
Plugin WildFly Maven 1.1.0.Alpha5
P.S This Spring MVC web application will be used for this deployment test.
1. Déployer WAR sur WildFly
1.1 Start WildFly in standalone mode.
$ ./wildfly-9.0.2.Final/bin/standalone.sh ========================================================================= JBoss Bootstrap Environment JBOSS_HOME: /home/example/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
org.wildfly.plugins wildfly-maven-plugin 1.1.0.Alpha5
1.3 Deploy with mvn wildfly:deploy
Terminal WildFly
... ... 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 Undeploy with mvn wildfly:undeploy
Terminal WildFly
... ... 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/example/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. Mettre à jour le contexte Web
Par défaut, le nom de fichier du fichierwar
(dans le dossier cible) sera enregistré comme contexte Web. Pour le personnaliser, définissez un nom de déploiement en configurant l'optionname
comme ceci:
pom.xml
org.wildfly.plugins wildfly-maven-plugin 1.1.0.Alpha5 127.0.0.1 9990 example password spring4ajax.war
Dans la configuration ci-dessus, lespring4ajax
sera le nouveau chemin du contexte Web -http://localhst:8080/spring4ajax
Note
N'oubliez pas d'ajouter le suffixe .war, sinon, AUCUN contexte Web ne sera enregistré!