我有一个包plugins
,并且有一些java源:
plugins - | - Plugin1.java
| - Plugin2.java
| - ............
| - PluginN.java
我需要编译jar文件中的每个插件。我想结束 plugin1.jar,plugin2.jar等。 是否可以使用maven-assembly插件或maven-jar? 或者我需要开发自己的maven插件?
答案 0 :(得分:0)
你可以用maven-jar-plugin
来做到这一点 <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>make-plugin1-jar</id>
<phase>prepare-package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<includes>
<include>com/myapp/plugins/Plugin1.class</include>
</includes>
<finalName>plugin1.jar</finalName>
</configuration>
</execution>
<execution>
<id>make-plugin2-jar</id>
<goals>
<goal>jar</goal>
</goals>
<phase>prepare-package</phase>
<configuration>
<includes>
<include>com/myapp/plugins/Plugin2.class</include>
</includes>
<finalName>plugin2.jar</finalName>
</configuration>
</execution>
</executions>
</plugin>