Struts 2 provides several Maven Archetypes that create working applications based on a template. archetypes to create complete applications that can be used as the basis of our own applications. Once the archetype project is generated it can be extended to implement our application's functionality.
Table of Contents | ||||
---|---|---|---|---|
|
Available Archetypes
The following archetypes are available:
The Blank Archetype (struts2-archetype-blank)
Nearly-minimal Struts 2 application, includes only an example package/action and some minimal tests.
The Starter Archetype (struts2-archetype-starter)
...
Name | Description | ||
---|---|---|---|
| The id for the group the application belongs to. Usually is the root package for applications in your company, e.g. com.mycompany | ||
| The id for the project | | The base Java package to use for generated source code. Defaults to |
| The group id of the archetype. Will always be | ||
| The id of the archetype | ||
| The version of the archetype | ||
| (Optional) The base Java package to use for generated source code. Defaults to | ||
| 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-to-run Struts project. Just run "mvn install" to build.
Command Quick Reference
These commands are used from the directory created by the archetype plugin.
- To build
Code Block |
---|
mvn install
|
- To create IntelliJ IDEA project files
Code Block |
---|
mvn idea:idea
|
- To create Eclipse project files
Code Block |
---|
mvn eclipse:eclipse
|
- To run test cases
Code Block |
---|
mvn test
|
- To clean up (removes generated artifacts)
Code Block |
---|
mvn clean
|
- To package (creates a WAR file)
Code Block |
---|
mvn package
|
- To grab necessary JAR files etc.
Code Block |
---|
mvn initialize
|
- To run it with Jetty
Code Block |
---|
mvn jetty:run
|