adam bien's blog

Kickstarting Real World Java EE 6 Projects With Maven 3 📎

  1. Install maven 3
  2. Execute: mvn archetype:generate
  3. Search for: webapp-javaee6. Choose it by entering the corresponding number (currently 268, but it can change at any time) to the wizard.
  4. Answer the remaining questions (groupId, artifactId, use the highest archetype version)
  5. If you plan to write some JUnit tests, replace the Java EE 6 API dependency with appserver implementation.
  6. Open the project with NetBeans 7 (Java EE). Start with e.g. EJB 3.1
  7. Click on the project and "Run" it. NetBeans 7 will start the bundled GlassFish 3.1 and deploy the application. JBoss 6 is supported as well, but has to be downloaded separately.

There is no need to use mvn archetype:generate first. You could start straight with NetBeans 7 as well. NetBeans 7 also uses Maven 3 archetypes to generate the project structure for you. It even tries to download the newest artifact version from the maven repo. There is no (proprietary) secret sauce.

[See also page 132, chapter "Build and Deployment" in Real World Java EE Night Hacks--Dissecting the Business Tier. X-ray was also started with mvn archetype:generate].