0

我正在尝试使用 Quarkus Gradle 插件构建具有所有依赖项(可运行)的 uberJar。使用 Maven,您可以通过向插件添加配置来构建它。

这就是它在 maven 中的样子:

<plugin>
    <groupId>io.quarkus</groupId>
    <artifactId>quarkus-maven-plugin</artifactId>
    <version>${quarkus.version}</version>
    <configuration>
        <uberJar>true</uberJar>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>build</goal>
            </goals>
        </execution>
    </executions>
</plugin>

有没有可能在 gradle 插件中设置这个属性?id 'io.quarkus.gradle.plugin' 版本 '0.12.0'

4

3 回答 3

1

该选项的名称是“uber-jar”。要设置此属性,您必须从命令行开始构建:

>gradle quarkusBuild --uber-jar

我在构建过程中遇到了一些错误,比如那个

Caused by: java.nio.file.NoSuchFileException: /Users/sven/Idea/getting-started/build/getting-started.jar

但最终构建成功

于 2019-03-30T14:21:41.767 回答
0

您可以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
于 2019-11-01T14:00:56.327 回答
0

quarkusBuild任务包含一个名为的属性uberJar,您可以使用它来控制 uberJar 行为(请参阅)。

于 2019-03-29T16:16:30.050 回答