您可以build.gradle
使用以下方式直接配置任务:
task buildUberJar(type: io.quarkus.gradle.tasks.QuarkusBuild, dependsOn: build) {
uberJar = true
}
但是,我发现使用这种方法的 jar 之间的资源重叠存在很多问题。这是我的输出的一个子集:
> Task :service-asset-management:buildUberJar
building quarkus runner
Duplicate entry META-INF/quarkus-extension.json entry from io.quarkus:quarkus-jackson::jar:0.26.1(runtime) will be ignored. Existing file was provided by io.quarkus:quarkus-kubernetes-client::jar:0.26.1(runtime)
Duplicate entry NOTICE entry from org.apache.kafka:kafka-clients::jar:2.2.1(runtime) will be ignored. Existing file was provided by org.ehcache:ehcache::jar:3.6.1(runtime)
Duplicate entry META-INF/quarkus-extension.json entry from io.quarkus:quarkus-arc::jar:0.26.1(runtime) will be ignored. Existing file was provided by io.quarkus:quarkus-kubernetes-client::jar:0.26.1(runtime)
Duplicate entry META-INF/quarkus-extension.json entry from io.quarkus:quarkus-core::jar:0.26.1(runtime) will be ignored. Existing file was provided by io.quarkus:quarkus-kubernetes-client::jar:0.26.1(runtime)
Dependencies with duplicate files detected. The dependencies [org.apache.kafka:kafka-clients::jar:2.2.1(runtime), org.ehcache:ehcache::jar:3.6.1(runtime)] contain duplicate files, e.g. NOTICE
Dependencies with duplicate files detected. The dependencies [io.quarkus:quarkus-core::jar:0.26.1(runtime), io.quarkus:quarkus-jackson::jar:0.26.1(runtime), io.quarkus:quarkus-kubernetes-client::jar:0.26.1(runtime), io.quarkus:quarkus-arc::jar:0.26.1(runtime)] contain duplicate files, e.g. META-INF/quarkus-extension.json
Dependencies with duplicate files detected. The dependencies [commons-logging:commons-logging::jar:1.2(runtime), org.slf4j:jcl-over-slf4j::jar:1.7.25(runtime)] contain duplicate files, e.g. org/apache/commons/logging/impl/SimpleLog$1.class