Advertise with us

Search Mastertheboss

Our eBooks

JBoss Maven example: building a Java EE 6 application

Testing the Maven project

Ok, you can test your project using the browser by pointing at the home page (home.xhtml)
jboss maven tutorial
This will display a Welcome page with the user and password text fields. In the lower part of the GUI, you can access to the RESTful service address where you can query for the list of all members: http://localhost:8080/as7example/rest/members or of a single member http://localhost:8080/as7example/rest/members/0
In our example, it will deliver:
                    <email>This email address is being protected from spambots. You need JavaScript enabled to view it.</email>
                    <name>John Smith</name>

Testing with Arquillian

The Member project ships also with a set of Arquillian test cases which can be used to test your application either on a local application server, or on a remotely running JBoss AS. Before running your Arquillian Test case we need to fix the Arquillian Container dependencies which need to point to the 1.0.0.CR7 release. So open up your pom.xml and fix it:


Then in in your Arquillan configuration file (arquillian.xml) set up the JBoss Home which is needed if you plan to run the test on a remote JBoss AS 7 installation:

<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns=""

   <!-- Example configuration for a remote JBoss AS 7 instance -->
   <container qualifier="jboss" default="true">
      <protocol type="jmx-as7">
         <property name="executionType">REMOTE</property>
         <property name="jbossHome">C:\\jboss-as-7.1.1.Final</property>


That's all. The following Maven goal will test your project on a local AS 7
mvn -e clean test -Parq-jbossas-managed

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.58 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.463s
[INFO] Finished at: Sun Apr 15 14:27:55 CEST 2012
[INFO] Final Memory: 18M/44M
[INFO] ------------------------------------------------------------------------
On the other hand, if you want to test on a remote AS 7 server, use the -Parq-jbossas-remote flag:
mvn -e clean test -Parq-jbossas-remote


So with this tutorial we have showed how to create a vanilla Java EE 6 project with Maven and how to import the Maven project into Eclipse. Maven allows a project to build using its project object model (POM) and a set of plugins that are shared by all projects using Maven, providing a uniform build system. Once you familiarize yourself with how one Maven project builds you automatically know how all Maven projects build saving you immense amounts of time when trying to navigate many projects.

© 2020 All Rights Reserved.

Please publish modules in offcanvas position.