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

At build time, in production mode (non-native), the Google Cloud Functions deployment build step requires a uber-jar because 'gcloud' deploys a single deployable jar. If the produced jar is not a uber-jar, the build fails with a BuildException.

Source

Thrown at extensions/funqy/funqy-google-cloud-functions/deployment/src/main/java/io/quarkus/funqy/gcp/functions/deployment/bindings/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",
                    Collections.EMPTY_LIST);
        }

        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", Collections.EMPTY_MAP);
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set quarkus.package.jar.type=uber-jar in application.properties
  2. Or build with -Dquarkus.package.jar.type=uber-jar
  3. Note native builds and non-production builds skip this check

Example fix

// before (application.properties)
# no package type set
// after
quarkus.package.jar.type=uber-jar
Defensive patterns

Strategy: validation

Validate before calling

// in application.properties for GCF targets
quarkus.package.jar.type=uber-jar

Prevention

When it happens

Trigger: Building a Funqy Google Cloud Function for production without quarkus.package.jar.type=uber-jar, so the JarBuildItem is not an uber-jar.

Common situations: Upgrading Quarkus where the default package type changed; copying build config from a non-GCF project; forgetting application.properties settings when adding GCF deployment.

Related errors


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