Getting Started Developing Applications

Creating your own application

What we didn’t tell you about the kitchensink quickstart is that it is generated from a Maven archetype. Using this archetype offers you the perfect opportunity to generate your own project.

You can create a project from the archetype using JBoss Developer Studio, or Eclipse with JBoss Tools. First, open up JBoss Central, if it isn’t already open. Hit Cmd-3 (Mac) or Ctrl-3 (Windows, Linux) and type JBoss Central:

Eclipse_JBoss_Central_1

You will now be shown JBoss Central, an excellent place to find about all things JBoss!

Eclipse_JBoss_Central_2

To create a new project, based on the kitchensink quickstart, click on Create Projects | Java EE Web Project:

Eclipse_JavaEEWebProject_1

JBoss Developer Studio will then check that you have the necessary pre-requisites to create the project. If you are using JBoss Developer Studio, then you should, otherwise, JBoss Tools will help you install the necessary pre-requisites. See JBoss Tools for more information.

Hit Next >. On the next screen you can enter a project name, package for sample code, and finally select a target runtime:

Eclipse_JavaEEWebProject_2

Finally, hit Finish. You’ll be presented with the New Project Example dialog, in which you can simply hit Finish:

Eclipse_JavaEEWebProject_3

You should now have a brand new project:

Eclipse_JavaEEWebProject_4

Enjoy!

To use the archetype to generate a new project, you should run:

mvn archetype:generate \
    -DarchetypeArtifactId=jboss-javaee6-webapp-archetype \
    -DarchetypeGroupId=org.jboss.spec.archetypes \
    -DarchetypeVersion=7.1.1.CR2 \

Maven will download the archetype and it’s dependencies, and ask you some questions:

$ > mvn archetype:generate \
        -DarchetypeArtifactId=jboss-javaee6-webapp-archetype \
        -DarchetypeGroupId=org.jboss.spec.archetypes \
        -DarchetypeVersion=7.1.1.CR2
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]

.........

Define value for property 'groupId': : com.acme.corp                 <1>
Define value for property 'artifactId': : acme-sales                 <2>
Define value for property 'version':  1.0-SNAPSHOT: :                <3>
Define value for property 'package':  com.acme.corp: :               <4>
[INFO] Using property: name = Java EE 6 webapp project               <5>
Confirm properties configuration:
groupId: com.acme.corp
artifactId: acme-sales
version: 1.0-SNAPSHOT
package: com.acme.corp
name: Java EE 6 webapp project
 Y: :
[WARNING] CP Don't override file /Users/pmuir/tmp/acme-sales/.settings/org.eclipse.jdt.apt.core.prefs
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.774s
[INFO] Finished at: Mon Jun 06 18:53:38 BST 2011
[INFO] Final Memory: 7M/125M
[INFO] ------------------------------------------------------------------------
$ >
  1. Enter the groupId you wish to use

  2. Enter the artifactId you wish to use

  3. Enter the version you wish to use, or just hit Enter if you wish to accept the default 1.0-SNAPSHOT

  4. Enter the java package you wish to use, or just hit Enter if you wish to accept the default (which is copied from groupId ).

  5. Finally, if you are happy with your choices, hit Enter and Maven will generate the project for you.

And that’s it, you now have a brand new project with the same functionality as kitchensink, but customized with your details.

Important

The archetype contains some sample code to get you started. If you would prefer a blank canvas, with only a project skeleton, then use jboss-javaee6-webapp-blank-archetype as your archetype id.

Important
Prefer Enterprise Applications (EARs)?

The archetype generates a WAR project. With Java EE 6, you can include EJBs in your WAR, meaning you won’t need an EAR until you need to divide your code into modules. If you would like to create an EAR based project then use jboss-javaee6-webapp-ear-archetype as your archetype id (or if you want a blank EAR, then jboss-javaee6-webapp-ear-blank-archetype).

Share the Knowledge

Find this guide useful?

Feedback

Find a bug in the guide? Something missing? You can fix it by [forking the repository](http://github.com/jboss-jdf/jboss-as-quickstart), making the correction and [sending a pull request](http://help.github.com/send-pull-requests). If you're just plain stuck, feel free to ask a question in the [user discussion forum](http://site-jdf.rhcloud.com/forums/jdf-users).

Recent Changelog

  • Jan 24, 2013: Compatibility updates for asciidoctor Dan Allen
  • Sep 17, 2012: Fixing jdf-78 Jason Porter
  • Jul 24, 2012: Update archetype guide to recommend using jbds Pete Muir
  • Jul 19, 2012: Add author to the guide Pete Muir
  • Jul 10, 2012: Initial import of getting started developing applications guide Pete Muir

See full history »