Information
This is basically a Struts' maven archetype plugin. It is used to create a working web application template for Struts 2 where the user work build on top of. It is to serve as a little tool for rapid prototyping.
Features
The created template contains :-
- Sitemesh integration build in
- A simple Struts action example (both instantiated through Spring and Struts itself)
- A simple Struts validation example (action and action-alias level)
- A Simple Struts conversion example (global and action level)
- A simple Struts resource bundle (both global, action and package level)
Installing Maven archetype for Struts 2
- Change directory to the maven archetype directory eg. from Struts' root directory (You will need the Struts 2 source from SVN)
cd ./struts2-archetype-starter <press enter>
- Run the following command to install Struts2 maven archetype into one's local maven repository (typically at ~/.m2/repository where ~ is the user directory)
- If "build successful" is shown at the console after execution of the above command, the Struts2 Maven archetype plugin is successfully installed.
Create Struts Web Application Template
To create a workable template:-
- Change directory to where the web application template is to be created eg. assuming the directory to be myWebApp.
mkdir /home/tmjee/myWebApp
cd /home/tmjee/myWebApp
- Run the following command to generate the sample template, assuming:-
Root Java package |
com.myCompany.mySystem |
The WAR name |
myWebApp |
mvn archetype:create -DgroupId=com.myComp.mySystem -DartifactId=myWebApp
-DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=struts2-archetype-starter
Using the created template
Following are some Maven command that might be handy when using the generated template :-
- To grab necessary JAR files etc.