Kickstarting Real World Java EE 6 Projects With Maven 3 📎
- Install maven 3
- Execute:
mvn archetype:generate
- Search for: webapp-javaee6. Choose it by entering the corresponding number (currently 268, but it can change at any time) to the wizard.
- Answer the remaining questions (groupId, artifactId, use the highest archetype version)
- If you plan to write some JUnit tests, replace the Java EE 6 API dependency with appserver implementation.
- Open the project with NetBeans 7 (Java EE). Start with e.g. EJB 3.1
- 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
].