You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何使用Gradle构建WildFly可执行Jar?官方文档仅提供Maven插件方案的替代方法问询

Gradle Alternative for WildFly Bootable Jars

Great question! Let’s clear this up for you:

WildFly’s official documentation only covers using the wildfly-jar-maven-plugin for building bootable Jars, and there’s no official Gradle plugin equivalent available right now.

That said, the workaround you referenced is indeed the closest practical solution we have at the moment—here’s a more detailed breakdown of how to implement it:

  • Step 1: Build a WildFly Hollow Bootable Jar with Maven
    A Hollow Jar is a lightweight, reusable WildFly runtime that doesn’t include your application code. Set up a simple Maven project, add the wildfly-jar-maven-plugin, configure it to use the hollow goal, and build the Jar. Publish it to your local Maven repository (or a private repo) so your Gradle project can pull it in as a dependency.

  • Step 2: Integrate the Hollow Jar into your Gradle WAR project
    Add the published Hollow Jar as a dependency in your Gradle build file. Then create a custom task to launch the WildFly runtime, pointing it to your compiled WAR file. For example, a bootRun task using JavaExec would look something like this:

task bootRun(type: JavaExec) {
    mainClass = 'org.wildfly.jar.boot.Main'
    classpath = sourceSets.main.runtimeClasspath
    args = ['--deploy', "${buildDir}/libs/your-application.war"]
}

A quick note: Some community members have experimented with wrapping the Maven plugin’s logic in Gradle (using tools like the Gradle Maven plugin or custom tasks), but these are unofficial solutions and may lack the same level of support or updates as the official Maven tooling.

内容的提问来源于stack exchange,提问作者bollin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.28 15:47:39