首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件开发 >

Maven常用命令拾掇

2012-07-04 
Maven常用命令整理Maven1的运行命令为:maven。常用命令为:maven: 编译源代码maven jar:依据项目生成jar文件

Maven常用命令整理
Maven1的运行命令为:maven。
常用命令为:
          maven: 编译源代码
          maven jar:依据项目生成jar文件
          maven clean:清除目标目录中的生成结果
          maven eclipse:生成eclipse项目文件 
Maven2的运行命令为:mvn。
常用命令为 :
          mvn archetype:create :创建 Maven 项目
          mvn compile :编译源代码
          mvn test-compile :编译测试代码
          mvn test : 运行应用程序中的单元测试
          mvn site : 生成项目相关信息的网站
          mvn clean :清除target目录中的生成结果
          mvn package : 依据项目生成 jar 文件
          mvn verify : 执行所有检查,验证包是有效的,符合质量规范
          mvn dependency:copy-dependencies :Goal that copies the project dependencies from the repository to a defined location.
          mvn install :在本地 Repository 中安装 jar
例子:mvn install:install-file -DgroupId=jta -DartifactId=jta -Dversion=1.0.1 -Dpackaging=pom -Dfile=jta-1.0.1.pom
          mvn eclipse:eclipse :生成 Eclipse项目文件
生成项目
          建一个 JAVA 项目 : mvn archetype:create -DgroupId=com.demo -DartifactId=App
          建一个 web 项目 : mvn archetype:create -DgroupId=com.demo -DartifactId=web-app -DarchetypeArtifactId=maven-archetype-webapp

部分名词解释:
archetype  是一个内建插件,他的create任务将建立项目骨架
archetypeArtifactId   项目骨架的类型
DartifactId 项目名称

可用项目骨架有:
* maven-archetype-archetype
* maven-archetype-j2ee-simple
* maven-archetype-mojo
* maven-archetype-portlet
* maven-archetype-profiles (currently under development)
* maven-archetype-quickstart
* maven-archetype-simple (currently under development)
* maven-archetype-site
* maven-archetype-site-simple, and
* maven-archetype-webapp

热点排行