Child pages
  • Struts Maven Archetypes
Skip to end of metadata
Go to start of metadata

This page is deprecated and replaced by the Struts 2 Maven Archetypes page.

It is being kept (for now) for release note links.


Struts provides several Maven Archetypes that create working applications based on a template.

Available Archetypes

The following archetypes are available:

The Starter Archetype (struts2-archetype-starter)

The Starter archetype creates a more featured application using several common technologies used in production applications.

Features

  • 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)

The Portlet Blank Archetype (struts2-archetype-portlet)

The Portlet blank archetype creates a minimally populated JSR 168 portlet.

Features

  • View, Edit, and Help mode examples
  • Simple form for preferences in Edit mode
  • Can be deployed as a servlet or portlet application
  • Can use Maven Jetty plugin to deploy as a servlet webapp

The Portlet Database Archetype (struts2-archetype-dbportlet)

The Portlet database archetype creates a simple JSR 168 portlet that displays the contents of a database table.

Features

  • Uses Spring and Hsql to show a real database query
  • Builtin caching of query results
  • View, Edit, and Help mode examples
  • Simple form for preferences in Edit mode
  • Can be deployed as a servlet or portlet application
  • Can use Maven Jetty plugin to deploy as a servlet webapp

Creating an Application Using an Archetype

From a working directory for your project, run the following command:

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.

Command Quick Reference

  • To build
  • To create IntelliJ IDEA project files
  • To create Eclipse project files
  • To run test cases
  • To clean up
  • To package
  • To grab necessary JAR files etc.
  • To run it with Jetty
  • No labels