在pom.xml添加插件
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.2.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.xxx.spider.Main</mainClass> </transformer> </transformers> </configuration> </execution> </executions> </plugin>
执行命令重新编译:
@echo off mvn package -DskipTests pause
编译生成文件