jil*_*len 3 maven maven-assembly-plugin
假设我们的项目中有以下包
org.xxx.dao,org.xxx.service,org.xxx.service.impl
所有的包都在源文件夹src/main/java中
我可以将包装配到分离的罐子里(xxx-dao.jar,xxx-service.jar,xxx-service-impl.jar)?
你可以使用这个标准maven-jar-plugin:
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>dao</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<index>true</index>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
<classifier>dao</classifier>
<includes>
<include>org/xxx/dao/**/*</include>
</includes>
</configuration>
</execution>
<execution>
<id>service</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<archive>
<index>true</index>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
</archive>
<classifier>service</classifier>
<includes>
<include>org/xxx/service/**/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
这为您提供了一个包含所有内容的JAR,然后是几个只包含所选内容的JAR,您可以使用Maven POM中的分类器进行选择.
如果你想省略默认的JAR(包含一切),那么你更换一个<id>具有<id>default-jar</id>与添加<excludes>,因为默认的JAR包括一切元素,所以你必须摆脱任何你不想要的.
| 归档时间: |
|
| 查看次数: |
904 次 |
| 最近记录: |