网上好多用maven2创建struct2的文章,不过能用的没有几个,Google了一下,终于找个一个,哈哈!
原文链接 http://cwiki.apache.org/confluence/display/WW/Struts+Maven+Archetypes
1 创建方法
mvn archetype:create -DgroupId=tutorial /
-DartifactId=tutorial /
-DarchetypeGroupId=org.apache.struts /
-DarchetypeArtifactId=struts2-archetype-starter /
-DarchetypeVersion=2.0.11.2
2 参数介绍
| 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.
3 常用命令
- To build
mvn install
- To create IntelliJ IDEA project files
mvn idea:idea
- To create Eclipse project files
mvn eclipse:eclipse
- 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 Jetty
mvn jetty:run
本文介绍如何使用Maven和Struts2框架快速搭建一个可运行的项目,并提供了详细的命令参数说明及常见构建命令。
727





