JBoss.orgCommunity Documentation

Chapter 3. Errai JAX-RS Maven Archetype

You can use the Errai JAX-RS maven archetype to get started quickly. It will generate a fully functional CRUD application using JAX-RS.

mvn archetype:generate \
-DarchetypeGroupId=org.jboss.errai.archetypes \
-DarchetypeArtifactId=jaxrs-quickstart \
-DarchetypeVersion=2.0.Beta1 \
-DarchetypeRepository=https://repository.jboss.org/nexus/content/groups/public/

Customize the build properties according to your needs.

Define value for property 'groupId': : foo.bar
Define value for property 'artifactId': : rest-app
Define value for property 'version': 1.0-SNAPSHOT:
Define value for property 'package': foo.bar: com.foo.bar
Confirm properties configuration:
groupId: foo.bar
artifactId: rest-app
version: 1.0-SNAPSHOT
package: com.foo.bar
Y:

The project will be created in a directory that corresponds to the provided artifactId.

Now we have a fully working build environment set up in a few, simple steps. You can already use it to launch the GWT development mode or to package your web application for deployment.

mvn gwt:run (launch hosted mode)
mvn gwt:debug (launch hosted with debug settings)

The example application comes with an integration test suite that exercises most of its client-side and server-side code. To run the test suite, type:

mvn test -Pintegration-test

To generate a set of HTML documents under target/site/jacoco/ detailing code coverage of the most recent test run, type:

mvn site -Pintegration-test

To deploy your application to JBoss, you need to execute a clean rebuild using the JBoss profile (e.g. -Pjboss7)

mvn -Pjboss7 clean install
cp target/rest-app.war $JBOSS_HOME/standalone/deployments