maven通过插件maven-assembly-plugin可以将所有所有jar打包到一个jar中。
1 <plugins> 2 <plugin> 3 <artifactId>maven-assembly-plugin</artifactId> 4 <configuration> 5 <archive> 6 <manifest> 7 <!--这里要替换成jar包main方法所在类 --> 8 <mainClass>com.sf.pps.client.IntfClientCall</mainClass> 9 </manifest> 10 <manifestEntries> 11 <Class-Path>.</Class-Path> 12 </manifestEntries> 13 </archive> 14 <descriptorRefs> 15 <descriptorRef>jar-with-dependencies</descriptorRef> 16 </descriptorRefs> 17 </configuration> 18 <executions> 19 <execution> 20 <id>make-assembly</id> <!-- this is used for inheritance merges --> 21 <phase>package</phase> <!-- 指定在打包节点执行jar包合并操作 --> 22 <goals> 23 <goal>single</goal> 24 </goals> 25 </execution> 26 </executions> 27 </plugin> 28 </plugins>