1. 程式人生 > >maven 多模組合併打包

maven 多模組合併打包

使用 maven-shade-plugin 外掛實現多模組專案開發,合併 class 打包成一個jar 包


<plugin>
    <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-shade-plugin</artifactId>
     <executions>
         <execution>
             <phase>package</phase>
             <goals
>
<goal>shade</goal> </goals> <configuration> <createSourcesJar>true</createSourcesJar> <promoteTransitiveDependencies>true</promoteTransitiveDependencies> <!-- 包含要合併的模組 -->
<artifactSet> <includes> <include>oo.xxx:xxx-xxxxx-core/include> <include>oo.xxx:xxx-xxxxx-common/include> <include>oo.xxx:xxx-xxxxx-config/include> </includes
>
</artifactSet> <!-- 包含號合併的資原始檔 --> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"> <resource>META-INF/xxxxx </resource> </transformer> </transformers> </configuration> </execution> </executions> </plugin>