Tuesday, August 23, 2011

Maven Web Prototype Project Archetype

Sometimes to create a java web application project prototype is really a daunting task. You need to config web.xml then Spring framework and Hibernate also Unit test, integration test and selenium test so on.

Maven provides the functionality to generate a project from archetype in seconds. An archetype is basically a template or skeleton of a project. More details are available here.

Now I have created an archetype archive attached here with a pom file.

To use the archetype, first you need to install the archive into your local maven repository by command


mvn install:install-file
-Dfile=web-prototype-archetype-1.0-SNAPSHOT.jar
-DpomFile=pom.xml


then generate your own project from the archetype


mvn archetype:generate
-DinteractiveMode=false
-DarchetypeGroupId=melbourne.k.ben
-DarchetypeArtifactId=web-prototype-archetype
-DarchetypeVersion=1.0-SNAPSHOT
-DgroupId=<your group id>
-DartifactId=<your artifact id>


So what inside my target project of this archetype? It is a simple web application based on Spring MVC. The detailed structure :


Web Tier: Tiles+ Spring MVC
DI: Spring and Spring Resource Bundle Message
Test: Mockito + selenium RC
App Server: Glassfish


Notice: the projects only tested in Maven2.0.9 and I haven't added Hibernate into it. Also I am planning to upgrade Spring to 3.0.6 currently using 2.5.6 and selenium RC is quite old as well should upgrade it to web driver.

No comments:

Post a Comment