一、maven常用命令:
1.mvn clean 清空产生的项目( target里)
2.mvn compile 编译源代码
3.mvn install 在本地repository中安装jar(包含mvn compile,mvn package,然后上传到本地仓库)
4.mvn deploy 上传到私服(包含mvn install,然后,上传到私服)
5.mvn package 打包
6.mvn test 运行测试
7.mvn site 产生site
8.mvn test-compile 编译测试代码
9.mvn -Dtest package 只打包不测试
10.mvn jar:jar 只打jar包
11.mvn test -skipping compile -skipping test-compile 只测试而不编译,也不测试编译
12.mvn deploy
13.mvn source.jar 源码打包
二、把pom文件中配置的依赖jar包打进来,打成一个包:要用maven-assembly-plugin 这个插件,在pom文件加如下配置
<build> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>assembly</goal> </goals> </execution> </executions> </plugin> </plugins> </build>