`
san_yun
  • 浏览: 2593986 次
  • 来自: 杭州
文章分类
社区版块
存档分类
最新评论

maven 小结(打包和单元测试)

 
阅读更多

1. 如何把一个jar和他依赖的包打包成一个

使用maven so easy!

<build>
		<plugins>
			<plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
                 <executions>
                     <execution>
                         <phase>package</phase>
                         <goals>
                             <goal>shade</goal>
                         </goals>
                     </execution>
                 </executions>
                 <configuration>
                     <finalName>tlog2-service-test</finalName>
                     <transformers>
                         <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                             <mainClass>com.taobao.tlog.test.StarAgentGatherTester</mainClass>
                         </transformer>
                     </transformers>
                 </configuration>
             </plugin>
		</plugins>
	</build>	

 

2. 如果希望单元测试代码也被打包

参考:http://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics