quarkusio/quarkus · error · BuildException

Google Cloud Function deployment need to use a uberjar, plea

Error message

Google Cloud Function deployment need to use a uberjar, please set 'quarkus.package.jar.type=uber-jar' inside your application.properties

What it means

A Quarkus build-time BuildException from CloudFunctionsDeploymentBuildStep.functionDeployment: in production JVM mode the Google Cloud Functions deployment step requires an uber-jar, and the build produced a non-uber (fast-jar/legacy) jar instead. The build fails fast so gcloud deploys a valid single-jar artifact.

Source

Thrown at extensions/google-cloud-functions-http/deployment/src/main/java/io/quarkus/gcp/functions/http/deployment/CloudFunctionsDeploymentBuildStep.java:26

import io.quarkus.builder.BuildException;
import io.quarkus.deployment.IsProduction;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem;
import io.quarkus.deployment.pkg.builditem.JarBuildItem;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
import io.quarkus.deployment.pkg.steps.NativeBuild;

public class CloudFunctionsDeploymentBuildStep {
    /**
     * Creates a target/deployment dir and copy the uber jar in it.
     * This facilitates the usage of the 'gcloud' command.
     */
    @BuildStep(onlyIf = IsProduction.class, onlyIfNot = NativeBuild.class)
    public ArtifactResultBuildItem functionDeployment(OutputTargetBuildItem target, JarBuildItem jar)
            throws BuildException, IOException {
        if (!jar.isUberJar()) {
            throw new BuildException("Google Cloud Function deployment need to use a uberjar, " +
                    "please set 'quarkus.package.jar.type=uber-jar' inside your application.properties",
                    List.of());
        }

        Path deployment = target.getOutputDirectory().resolve("deployment");
        if (Files.notExists(deployment)) {
            Files.createDirectory(deployment);
        }

        Path jarPath = jar.getPath();
        Path targetJarPath = deployment.resolve(jarPath.getFileName());
        Files.deleteIfExists(targetJarPath);
        Files.copy(jarPath, targetJarPath);

        return new ArtifactResultBuildItem(targetJarPath, "function", Map.of());
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set quarkus.package.jar.type=uber-jar in application.properties
  2. Rebuild the application so the deployment artifact step completes
  3. If you intended a container-based deploy, consider the native or container build path instead of the uber-jar deployment step

Example fix

# before
# (no packaging config — defaults to fast-jar)
# after
quarkus.package.jar.type=uber-jar
Defensive patterns

Strategy: validation

Validate before calling

// check packaging config before building for GCP
Properties p = new Properties();
p.load(new FileInputStream("src/main/resources/application.properties"));
if (!"uber-jar".equals(p.getProperty("quarkus.package.jar.type"))) {
    throw new IllegalStateException("GCP functions need quarkus.package.jar.type=uber-jar");
}

Try / catch

try {
    QuarkusBuildRunner.run("package");
} catch (QuarkusBuildException e) {
    if (e.getMessage().contains("uberjar")) {
        // fix application.properties then rebuild
    } else throw e;
}

Prevention

When it happens

Trigger: Running a production build (IsProduction) without native mode while quarkus.package.jar.type is not uber-jar, then executing the functionDeployment build step.

Common situations: Upgraded Quarkus where the default packaging changed to fast-jar but the GCP functions deployment still expects uber-jar; newly created function project missing the packaging property in application.properties.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/fc8f7275dc8f70ee. Report an issue: GitHub.