maven编译测试打包



  

使用生命周期命令:

清空:mvn clean

编译:mvn compile

测试:mvn test

打包:mvn package (是打jar还是war可以在pom中的<packaging>里配置)

引入第三方jar包:

	<build>
		<plugins>
			<plugin>
			    <groupId>org.apache.maven.plugins</groupId>
			    <artifactId>maven-shade-plugin</artifactId>
			    <version>3.1.0</version>
			    <executions>
			    	<execution>
			    		<phase>package</phase>
			    		<goals>
			    			<goal>shade</goal>
			    		</goals>
			    	</execution>
			    </executions>
			</plugin>
		</plugins>
	</build> 

 执行package后,会自动把第三方jar包的class文件放入本地jar里

使用插件命令:

编译项目文件:

mvn compiler:compile

编译测试文件:

mvn compiler:testCompile

执行测试用例:

mvn surefire:test

猜你喜欢

转载自jobury.iteye.com/blog/2415455