Maven 打包可执行jar
程序员文章站
2022-04-28 19:11:16
...
只需要在pom.xml文件中配置以下内容,<mainClass>标签指定main方法即可
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.han.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>