I want to deploy WAR of Maven project to JBoss server. I know that from Eclipse Export->War deploy the WAR file to JBoss. But How can I do this for Maven Project. Any step b
Simply adding below plugin to POM.xml worked for me.
<build>
...
<plugins>
...
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.9.Final</version>
</plugin>
...
</plugins>
...
</build>
Using command prompt one can deploy or undeploy the artifact.
mvn jboss-as:redeploy
mvn jboss-as:undeploy
Note: The above option uses http://localhost:9999 url to deploy the artifact to server. The Jboss server should be running in background before the command is executed.
Also one can use eclipse to execute above goals.
Step 1: Click on run configuration.
Step 2:Create a new Maven Build
Step 3:Update build details as shown.
More option can be found at
https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-war</id>
<phase>install</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<type>${project.packaging}</type>
<overWrite>true</overWrite>
<outputDirectory>C:\jboss-as-7.1.1.Final_AMGEN\jboss-as-7.1.1.Final\standalone\deployments</outputDirectory>
<destFileName>${project.build.finalName}.${project.packaging}</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
here <outputDirectory>
"containes address of deployment folder in Jboss"</outputDirectory>
put the given code accordingly in pom.xml
The correct format is:
<fileName>${basedir}/target/webapp.war</fileName>
Assumption
I am assuming that you have already installed the plugins for Maven for eclipse.
Installation
While selecting the project in project explorer select Run --> Run As --> Maven Install
Running Jboss
Go to Run --> Run Configurations..
Add new Maven Build
Name the Process, Select the Base directory that will be deployed as war
set the Goal --> jboss:start
By following the steps you can deploy every thing via Eclipse.
Have fun. :)
Use the following goals to deploy your war in Jboss folder
clean install jboss:hard-deploy
Well http://cargo.codehaus.org/Maven2+plugin could be a nice alternative, too.