10.6.2. 用 Maven 部署应用程序
必须具备的条件
本节展示了用 Maven 卸载应用程序的方法。下面的例子使用了 JBoss EAP 6 Quickstarts 里的 jboss-as-helloworld.war 应用程序。helloworld 项目包含了一个初始化了 jboss-as-maven-plugin 的 POM 文件。这个插件提供了在应用服务器里部署和卸载应用程序的简单操作。
过程 10.12. 用 Maven 部署应用程序
- 打开终端会话并进入包含 Quickstart 例程的目录里。
例 10.9. 进入 helloworld 应用程序目录
[localhost]$ cd /QUICKSTART_HOME/helloworld
- 运行 Maven deploy 命令来部署应用程序。如果应用程序已经运行,它将被重新部署。
[localhost]$ mvn package jboss-as:deploy
- 查看结果。
- 通过在终端窗口里查看操作日志可以确认部署。
例 10.10. 通过 Maven 确认 Helloworld 应用程序
[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 32.629s [INFO] Finished at: Fri Mar 14 09:09:50 EDT 2014 [INFO] Final Memory: 23M/204M [INFO] ------------------------------------------------------------------------
- 部署在活动应用程序服务器实例的状态流里也可以确认。
例 10.11. 通过应用服务器确认 Helloworld 应用程序
09:09:49,167 INFO [org.jboss.as.repository] (management-handler-thread - 1) JBAS014900: Content added at location /home/username/EAP_HOME/standalone/data/content/32/4b4ef9a4bbe7206d3674a89807203a2092fc70/content 09:09:49,175 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "jboss-helloworld.war" (runtime-name: "jboss-helloworld.war") 09:09:49,563 INFO [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016002: Processing weld deployment jboss-helloworld.war 09:09:49,611 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: jboss-helloworld.war 09:09:49,680 INFO [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900 1.1.17 (redhat) 09:09:49,705 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) JBAS016008: Starting weld service for deployment jboss-helloworld.war 09:09:50,080 INFO [org.jboss.web] (ServerService Thread Pool -- 55) JBAS018210: Register web context: /jboss-helloworld 09:09:50,425 INFO [org.jboss.as.server] (management-handler-thread - 1) JBAS018559: Deployed "jboss-helloworld.war" (runtime-name : "jboss-helloworld.war")
应用程序已部署到应用服务器里。

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.