<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.juvenxu.mvnbook.helloworld.HelloWorld
</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
添加插件,指定mainClass既可.
original-xxx.jar 是源码包,上面的是可执行包,可以资MANIFEST.MF中看到如下配置
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: User
Created-By: Apache Maven 3.6.0
Build-Jdk: 1.8.0_201
Main-Class: com.juvenxu.mvnbook.helloworld.HelloWorld