Customize JBoss Maven pom.xml

A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.
So open the pom.xml file which is located at the root of your project and modify the following lines:

If you haven't set your JBOSS_HOME env variable just set it at line 25

<jboss.home>C:\jboss-as-7.1.1.Final</jboss.home>

Then, set the correct JBoss AS version in all dependencies found in the pom.xml file. For example:
<dependency>
            <groupId>org.jboss.as</groupId>
            <artifactId>jboss-as-arquillian-container-managed</artifactId>
            <version>7.1.1.Final</version>
            <scope>test</scope>
</dependency>

That's all! now you can package your project by issuing:

$ mvn install
[INFO] Scanning for projects...
. . . . . . .
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.657s
[INFO] Finished at: Wed Apr 11 12:58:19 CEST 2012
[INFO] Final Memory: 7M/21M
[INFO] ---------------------

Finally deploy the application to JBoss AS 7 using: 

$ mvn jboss-as:deploy
. . . . . .
INFO: XNIO Version 3.0.7.GA
nov 05, 2013 5:10:07 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.7.GA
nov 05, 2013 5:10:07 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.12.GA
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.082s
[INFO] Finished at: Tue Nov 05 17:10:12 CET 2013
[INFO] Final Memory: 13M/175M
[INFO] ------------------------------------------------------------------------

Now launch Eclipse and choose from the Menu: File | Import | Existing Maven Projects

JBoss Maven tutorial

As a result, your Maven project will be imported and you will have automatically imported as well all the required dependencies.

jboss maven example tutorial

0
0
0
s2smodern