duckflew
duckflew
Published on 2025-05-07 / 2 Visits
0
0

Maven打包vert.x的Fat Jar 插件配置

  <!-- Maven Shade 插件 -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.2</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <!-- 关键配置 -->
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <!-- 指定 Vert.x 的 Launcher 作为入口 -->
                                        <Main-Class>io.vertx.core.Launcher</Main-Class>
                                        <!-- 指定你的主 Verticle 类 -->
                                        <Main-Verticle>com.logcan.MainVerticle</Main-Verticle>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                            <!-- 包含所有依赖 -->
                            <artifactSet>
                                <includes>
                                    <include>*:*</include>
                                </includes>
                            </artifactSet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Comment