介绍一款maven插件:maven-shade-plugin
使用方法:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>org/apache/spark/**</exclude> </excludes> </filter> </filters> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.dsj361.service.TaskStarter</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin>
<build>
<plugins>
(放在pom.xml的这个位置即可)
</plugins>
</build>
另外,这个插件除了过滤这个功能之外,还有很多强大的功能。如果有需要可以参考这个:
https://blog.csdn.net/zhengxiangwen/article/details/69525182