9.5.2. Deploy an Application with Maven
Prerequisites
This task shows a method for deploying applications with Maven. The example provided uses the jboss-as-helloworld.war
application found in the JBoss EAP 6 Quickstarts collection. The helloworld
project contains a POM file which initializes the jboss-as-maven-plugin
. This plugin provides simple operations to deploy and undeploy applications to and from the application server.
Procedure 9.11. Deploy an application with Maven
Run the Maven deploy command in a terminal session
Open a terminal session and navigate to the directory containing the quickstart examples.- Run the Maven deploy command to deploy the application. If the application is already running, it will be redeployed.
[localhost]$ mvn package jboss-as:deploy
Confirm the application deployment
View result in terminal window
The deployment can be confirmed by viewing the operation logs in the terminal window.Example 9.5. Maven confirmation for helloworld application
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3 seconds [INFO] Finished at: Mon Oct 10 17:22:05 EST 2011 [INFO] Final Memory: 21M/343M [INFO] ------------------------------------------------------------------------
View results in server terminal window
The deployment can also be confirmed in the status stream of the active application server instance.Example 9.6. Application server confirmation for helloworld application
17:22:04,922 INFO [org.jboss.as.server.deployment] (pool-1-thread-3) Content added at location /home/username/EAP_HOME/standalone/data/content/2c/39607b0c8dbc6a36585f72866c1bcfc951f3ff/content 17:22:04,924 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) Starting deployment of "jboss-as-helloworld.war" 17:22:04,954 INFO [org.jboss.weld] (MSC service thread 1-3) Processing CDI deployment: jboss-as-helloworld.war 17:22:04,973 INFO [org.jboss.weld] (MSC service thread 1-2) Starting Services for CDI deployment: jboss-as-helloworld.war 17:22:04,979 INFO [org.jboss.weld] (MSC service thread 1-4) Starting weld service 17:22:05,051 INFO [org.jboss.web] (MSC service thread 1-2) registering web context: /jboss-as-helloworld 17:22:05,064 INFO [org.jboss.as.server.controller] (pool-1-thread-3) Deployed "jboss-as-helloworld.war"
The application is deployed to the application server.