Adam Bien's Weblog

Thursday May 26, 2011

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].


NEW: Java EE 7 Testing and Quality Workshop

A book about rethinking Java EE Patterns

Comments:

Hi Adam... there is a misleading (*lol*) typo in the title of this post...

Posted by Robert Herschke on May 26, 2011 at 12:30 PM CEST #

@Robert,

typo? :-)

adam

Posted by Adam Bien on May 26, 2011 at 12:55 PM CEST #

did you mean kickstarting instead of kicktarting?

well "tarting" is a funny happy accident too ;-)

Posted by Robert Herschke on May 26, 2011 at 01:15 PM CEST #

processs taught ok!!!

Posted by Lava Kafle on May 26, 2011 at 01:18 PM CEST #

This is why I love Netbeans. No secret sauce, no special project settings magic; the easiest way to set up a headless build for your project !

Such simplicity is a real achievement Bravo Netbeans team.

Posted by Donny on May 27, 2011 at 12:17 AM CEST #

"Search for: webapp-javaee6 .. (currently 268..)" - that's the best joke on usability I've heard for a while :))

Posted by Kristof Jozsa on May 27, 2011 at 03:08 AM CEST #

@Kristof,

if you already know the name: "webapp-javaee6" - you can directly enter it.

Hence NetBeans uses exactly the same mechanism, I always use NetBeans for initial setup. That is very usable - only few clicks :-)

thanks!,

adam

Posted by Adam Bien on May 27, 2011 at 11:40 AM CEST #

Adam this would be a much more helpful post if you could provide the filter string here.

Something like:

mvn archetype:generate -Dfilter=org.apache:struts

http://maven.apache.org/archetype/maven-archetype-plugin/usage.html

Posted by dhawan on July 21, 2012 at 11:22 AM CEST #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
...the last 150 posts
...the last 10 comments
Links
License