Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Struts Maven Archetype
Added by tm_jee, last edited by Wendy Smoak on Nov 16, 2006  (view change)

The Struts Maven Archetype creates a working web application template.

Features

  • Standard Maven environment
  • Sitemesh integration
  • Action example (both instantiated through Spring and Struts itself)
  • Validation example (action and action-alias level)
  • Conversion example (global and action level)
  • Resource bundle (both global, action and package level)

Installing the Archetype

  1. Install Maven 2
  2. Install Subversion
  3. Checkout the Struts 2 source code (svn co http://svn.apache.org/repos/asf/struts/struts2/trunk)

Creating an Application

From a working directory for your project:

mvn archetype:create -DgroupId=tutorial \
                       -DartifactId=tutorial \
                       -DarchetypeGroupId=org.apache.struts \
                       -DarchetypeArtifactId=struts2-archetype-starter \
                       -DarchetypeVersion=2.0.2-SNAPSHOT \

Substitute the name of your project for "tutorial". Substitute your own package name for "org.apache.struts".

The Archetype will create a ready-run Struts project. Just run "mvn install" to build.

Command Quick Reference

  • To build
    mvn install
  • To run test cases
    mvn test
  • To clean up
    mvn clean
  • To package
    mvn package
  • To grab necessary JAR files etc.
    mvn initialize
  • To run it with Jetty6
    mvn jetty:run