常用 maven 命令

1.clean compile编译命令

maven-clean-plugin:2.4.1 删除target目录-->

maven-resources-plugin:2.5:resources 访问主资源-->

maven-compiler-plugin:2.3.2:compile编译主代码

2.clean test测试命令,包含clean compile

 

maven-clean-plugin:2.4.1 删除target目录-->

maven-resources-plugin:2.5:resources 访问主资源-->

maven-compiler-plugin:2.3.2:compile编译主代码-->

maven-resources-plugin:2.5:testResources访问测试资源-->

maven-compiler-plugin:2.3.2:testCompile编译测试代码-->

maven-surefire-plugin:2.10:test执行测试

 

3.clean package打包命令 ,包含clean test

maven-clean-plugin:2.4.1 删除target目录-->

maven-resources-plugin:2.5:resources 访问主资源-->

maven-compiler-plugin:2.3.2:compile编译主代码-->

maven- resources-plugin:2.5:testResources访问测试资源-->

maven-compiler-plugin:2.3.2:testCompile编译测试代码-->

maven-surefire-plugin:2.10:test执行测试-->

maven-war-plugin:2.1.1:war执行打包命令

4.clean install 安装命令安装在本地供其他项目直接调用 ,包含clean package

     clean install -u 强制让maven检查更新并且安装

5.jetty:run  在jetty中运行项目

6.dependency:list 显示所以已解析依赖,包含传递性依赖

 

7.dependency:tree 以树的形式显示依赖

 

8.dependency:analyze 解析要用的但是未声明的依赖和已声明的但是未使用的依赖

 

9.clean deploy 发布构件到远程仓库

10.跳过测试

 临时跳过测试:
 mvn package -Dmaven.test.skip=true
 maven.test.skip同时控制maven-compiler-plugin和maven-surefire-       plugin两个插件 的行为,即跳过编译,又跳过  测试。

 或者在pom.xml中配置

 <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-surefire-plugin</artifactId>  
     <configuration>  
         <skip>true</skip>  
     </configuration> 
 </plugin>

 

 

猜你喜欢

转载自labreeze.iteye.com/blog/1570215
今日推荐