quarkus 2.0 maven build没有为aws lambda创建uber jar

mwngjboj  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(273)

我正在使用quarkus 2.0构建uber jar,用作aws lambda。maven构建脚本如下所示:

<properties>
        <quarkus.package.type>uber-jar</quarkus.package.type>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-amazon-lambda</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugin>
                <groupId>io.quarkus</groupId>
                <artifactId>quarkus-maven-plugin</artifactId>
                <version>2.0.3.Final</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
``` `application.properties` 还包含 `quarkus.package.type=uber-jar` 配置。
当我调试maven build时,我看到在做出决策时, `quarkus-maven-plugin` 执行代码:

@BuildStep
public JarBuildItem buildRunnerJar(CurateOutcomeBuildItem curateOutcomeBuildItem, OutputTargetBuildItem outputTargetBuildItem, TransformedClassesBuildItem transformedClasses, ApplicationArchivesBuildItem applicationArchivesBuildItem, ApplicationInfoBuildItem applicationInfo, PackageConfig packageConfig, ClassLoadingConfig classLoadingConfig, List generatedClasses, List generatedResources, List uberJarRequired, List uberJarMergedResourceBuildItems, List uberJarIgnoredResourceBuildItems, List legacyJarRequired, QuarkusBuildCloseablesBuildItem closeablesBuildItem, List additionalApplicationArchiveBuildItems, MainClassBuildItem mainClassBuildItem, Optional appCDS) throws Exception {
if (appCDS.isPresent()) {
this.handleAppCDSSupportFileGeneration(transformedClasses, generatedClasses, (AppCDSRequestedBuildItem)appCDS.get());
}

    if (!uberJarRequired.isEmpty() && !legacyJarRequired.isEmpty()) {
        throw new RuntimeException("Extensions with conflicting package types. One extension requires uber-jar another requires legacy format");
    } else if (legacyJarRequired.isEmpty() && (!uberJarRequired.isEmpty() || packageConfig.type.equalsIgnoreCase("uber-jar"))) {
        /* I want it get there, but it doesn't due to "legacyJarRequired" containing an item, ("packageConfig == uber-jar" as expected) */          

        return this.buildUberJar(curateOutcomeBuildItem, outputTargetBuildItem, transformedClasses, applicationArchivesBuildItem, packageConfig, applicationInfo, generatedClasses, generatedResources, uberJarMergedResourceBuildItems, uberJarIgnoredResourceBuildItems, mainClassBuildItem);
    } else {
        /* execution gets there because "legacyJarRequired" contains an item */

        return legacyJarRequired.isEmpty() && !packageConfig.isLegacyJar() && !packageConfig.type.equalsIgnoreCase("legacy") ? this.buildThinJar(curateOutcomeBuildItem, outputTargetBuildItem, transformedClasses, applicationArchivesBuildItem, packageConfig, classLoadingConfig, applicationInfo, generatedClasses, generatedResources, additionalApplicationArchiveBuildItems, mainClassBuildItem) : this.buildLegacyThinJar(curateOutcomeBuildItem, outputTargetBuildItem, transformedClasses, applicationArchivesBuildItem, packageConfig, applicationInfo, generatedClasses, generatedResources, mainClassBuildItem);
    }
}
及 `legacyJarRequired` 在这里添加了

@BuildStep(onlyIf = IsNormal.class, onlyIfNot = NativeBuild.class)
public void requireLegacy(BuildProducer required) {
required.produce(new LegacyJarRequiredBuildItem());
}

如何避免将此元素添加到构建配置中以接收版本控制 `-yyy-zzz-runner.jar` 从我的应用程序构建? `function.zip` 它的构建很好,但这不是我的选择,因为我想把构建结果推给maven repo。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题