Deploying to JBoss AS 6.X through Maven

Submitted by Jochus on Wed, 02/01/2013 - 23:40 | Posted in: Java


In your POM file, add the following plugin:

<plugin>
     <groupId>org.codehaus.mojo</groupId>
     <artifactId>jboss-maven-plugin</artifactId>
     <version>1.5.0</version>
     <configuration>
         <jbossHome>${jbossHome}</jbossHome>
         <port>${jbossPort}</port>
         <serverName>${jbossServerName}</serverName>
         <fileName>target/my-webapp.war</fileName>
     </configuration>
</plugin>

In your settings.xml file (which is user dependent), add the following properties:

           ...
           <profile>
               <id>inject-application-home</id>
               <properties>
                   <jbossHome>/Applications/jboss-6.1.0.Final/</jbossHome>
                   <jbossPort>8080</jbossPort>
                   <jbossServerName>default</jbossServerName>
               </properties>
           </profile>
       </profiles>
       <activeProfiles>
           <activeProfile>inject-application-home</activeProfile>
       </activeProfiles>

To deploy, you can execute the command:

$ mvn jboss:hard-deploy
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building my-webapp Maven Webapp 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- jboss-maven-plugin:1.5.0:hard-deploy (default-cli) @ my-webapp ---
[INFO] Copying /Users/jochen/Documents/workspace/TestDeployWebapp/my-webapp/target/my-webapp.war to /Applications/jboss-6.1.0.Final/server/default/deploy/my-webapp.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.498s
[INFO] Finished at: Wed Jan 02 11:32:48 CET 2013
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------

Add new comment

The content of this field is kept private and will not be shown publicly.

Full HTML

  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.