1.mavenn安装见: http://blog.youkuaiyun.com/pengchua/archive/2007/09/17/1788228.aspx
1.命令: (参考:http://struts.apache.org/2.1.2/docs/struts-maven-archetypes.html)
mvn archetype:create -DgroupId=tutorial -Dart
ifactId=tutorial -DarchetypeGroupId=org.apache.struts -DarchetypeArtifactId=s
truts2-archetype-starter -DarchetypeVersion=2.0.5-SNAPSHOT -DremoteRepositori
es=http://people.apache.org/repo/m2-snapshot-repository
2.参数含义:
参数 |
含义 |
groupId |
当前应用程序隶属的Group的ID,通常是公司所有应用程序的根目录,例如:com.jpleasure |
artifactId |
当前应用程序的ID |
package |
代码生成时使用的根包的名字,如果没有给出,默认使用archetypeGroupId |
archetypeGroupId |
原型(archetype)的Group ID,因为我们这里使用的是Struts2的原型,所以这里总是org.apache.struts |
archetypeArtifactId |
原型(archetype)ID |
archetypeVersion |
原型(archetype)版本 |
remoteRepositories |
包含原型(archetype)的远程资源库的列表,如果部署在标准的maven资源库或者本地,这不需要标记本项 |
3.进入tutorial 项目路径
一些相关的Maven命令(注意要再项目目录中运行)
构建 mvn install
创建Eclipse项目文件 mvn eclipse:eclipse
运行测试 mvn test
清除 mvn clean
打包 mvn package
获得需要的JAR文件 mvn initialize
使用Jetty运行 mvn jetty:run