Deploying to JBoss AS 6.X through Maven
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] ------------------------------------------------------------------------