8.5.3. Undeploy an Application with Maven

Summary

This task shows a method for undeploying applications with Maven. The example provided uses the jboss-as-helloworld.war application found in the Enterprise Application Server Quick Starts collection. The helloworld project contains a POM file which initializes the jboss-as-maven-plugin. This plug-in provides simple operations to deploy and undeploy applications to and from the application server.

Procedure 8.12. Undeploy an application with Maven

  1. Run the Maven deploy command in a terminal session

    Open a terminal session and navigate to the directory containing the quickstart examples.

    Example 8.7. Change into the helloworld application directory

    [localhost]$ cd ~/EAP_Quickstarts/helloworld
    
  2. Run the Maven undeploy command to undeploy the application.
    [localhost]$ mvn jboss-as:undeploy
  3. Confirm the application undeployment

    • View result in terminal window

      The undeployment can be confirmed by viewing the operation logs in the terminal window.

      Example 8.8. Maven confirmation for helloworld application

                              
      [INFO] ------------------------------------------------------------------------
      [INFO] Building JBoss AS Quickstarts: Helloworld
      [INFO]    task-segment: [jboss-as:undeploy]
      [INFO] ------------------------------------------------------------------------
      [INFO] [jboss-as:undeploy {execution: default-cli}]
      [INFO] Executing goal undeploy for /home/username/EAP_Quickstarts/helloworld/target/jboss-as-helloworld.war on server localhost (127.0.0.1) port 9999.
      Oct 10, 2011 5:33:02 PM org.jboss.remoting3.EndpointImpl <clinit>
      INFO: JBoss Remoting version 3.2.0.Beta2
      Oct 10, 2011 5:33:02 PM org.xnio.Xnio <clinit>
      INFO: XNIO Version 3.0.0.Beta2
      Oct 10, 2011 5:33:02 PM org.xnio.nio.NioXnio <clinit>
      INFO: XNIO NIO Implementation Version 3.0.0.Beta2
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESSFUL
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 1 second
      [INFO] Finished at: Mon Oct 10 17:33:02 EST 2011
      [INFO] Final Memory: 11M/212M
      [INFO] ------------------------------------------------------------------------
      
    • View results in server terminal window

      The undeployment can also be confirmed in the status stream of the active application server instance.

      Example 8.9. Application server confirmation for helloworld application

           
      17:33:02,334 INFO  [org.jboss.weld] (MSC service thread 1-3) Stopping weld service
      17:33:02,342 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) Stopped deployment jboss-as-helloworld.war in 15ms
      17:33:02,352 INFO  [org.jboss.as.server.controller] (pool-1-thread-5) Undeployed "jboss-as-helloworld.war"
      
Result

The application is undeployed from the application server.