Skip to content

应用构建

This content is not available in your language yet.

Feat 应用可以通过 Maven 的 maven-shade-plugin 插件打包成一个包含所有依赖的可执行 jar 包(也称为 fat jar)。

pom.xml 中添加以下配置:

pom.xml
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>your.package.MainClass</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

执行以下命令进行打包:

Terminal window
mvn clean package