首页 > 技术文章 > maven 一个模块生成多个jar包

windspear 2016-08-24 10:50 原文

为了便于将一个模块中的接口提供给调用方,需要将部分pakage(interface、dto)单独打包,但是不包括impl类

<build>
<sourceDirectory>src</sourceDirectory>
<!--<testSourceDirectory>testSrc</testSourceDirectory>-->

<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>server</id>
<goals><goal>jar</goal></goals>
<phase>package</phase>
<configuration>
<classifier>interface</classifier>
<includes>
<include>**/interface/**</include>
</includes>
</configuration>
</execution>
<execution>
<id>client</id>
<goals><goal>jar</goal></goals>
<phase>package</phase>
<configuration>
<classifier>all</classifier>
<includes>
<include>**</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

推荐阅读