Apache Struts 2 Documentation > Home > Guides > Core Developers Guide > Struts Maven Archetypes |
Struts provides several Maven Archetypes that create working applications based on a template.
The following archetypes are available:
The Starter archetype creates a more featured application using several common technologies used in production applications.
The Portlet blank archetype creates a minimally populated JSR 168 portlet.
The Portlet database archetype creates a simple JSR 168 portlet that displays the contents of a database table.
From a working directory for your project, run the following command:
mvn archetype:create -DgroupId=tutorial \
-DartifactId=tutorial \
-DarchetypeGroupId=org.apache.struts \
-DarchetypeArtifactId=struts2-archetype-starter \
-DarchetypeVersion=2.0.5-SNAPSHOT \
-DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
This table describes the parameters used above:
Name | Description |
---|---|
groupId | The id for the group the application belongs to. Usually is the root package for applications in your company, e.g. com.mycompany |
artifactId | The id for the project |
package | The base Java package to use for generated source code. Defaults to archetypeGroupId if not specified. |
archetypeGroupId | The group id of the archetype. Will always be org.apache.struts for Struts archetypes |
archetypeArtifactId | The id of the archetype |
archetypeVersion | The version of the archetype |
remoteRepositories | A list of remote repositories that contain the archetype. If deployed to the standard Maven repository or locally, this is optional |
The Archetype will create a ready-run Struts project. Just run "mvn install" to build.
mvn install
mvn idea:idea
mvn eclipse:eclipse
mvn test
mvn clean
mvn package
mvn initialize
mvn jetty:run