quarkusio/quarkus · error · BuildException

Azure Function deployment need to use a legacy JAR, please s

Error message

Azure Function deployment need to use a legacy JAR, please set 'quarkus.package.jar.type=legacy-jar' inside your application.properties

What it means

Raised by AzureFunctionsProcessor.packageFunctions during the packaging build step when the Azure Functions package type is not the legacy (fast-jar predecessor) JAR format. The Azure Functions host loads the application through a legacy JAR layout; other package types (e.g., the default fast-jar) cannot be consumed by the Functions runtime, so the build step aborts with instructions to switch the package type.

Source

Thrown at extensions/azure-functions/deployment/src/main/java/io/quarkus/azure/functions/deployment/AzureFunctionsProcessor.java:92

    @BuildStep
    AzureFunctionsAppNameBuildItem appName(OutputTargetBuildItem output, AzureFunctionsConfig functionsConfig) {
        String appName = functionsConfig.appName().orElse(output.getBaseName());
        return new AzureFunctionsAppNameBuildItem(appName);
    }

    @BuildStep(onlyIf = IsProduction.class, onlyIfNot = NativeBuild.class)
    public ArtifactResultBuildItem packageFunctions(List<AzureFunctionBuildItem> functions,
            OutputTargetBuildItem target,
            AzureFunctionsConfig functionsConfig,
            PackageConfig packageConfig,
            AzureFunctionsAppNameBuildItem appName,
            JarBuildItem jar) throws Exception {
        if (functions == null || functions.isEmpty()) {
            log.warn("No azure functions exist in deployment");
            return null;
        }
        if (packageConfig.jar().type() != PackageConfig.JarConfig.JarType.LEGACY_JAR) {
            throw new BuildException("Azure Function deployment need to use a legacy JAR, " +
                    "please set 'quarkus.package.jar.type=legacy-jar' inside your application.properties",
                    List.of());
        }
        AnnotationHandler handler = new AnnotationHandlerImpl();
        HashSet<Method> methods = new HashSet<>();
        for (AzureFunctionBuildItem item : functions)
            methods.add(item.getMethod());
        final Map<String, FunctionConfiguration> configMap = handler.generateConfigurations(methods);
        final String scriptFilePath = String.format("../%s.jar", target.getBaseName() + packageConfig.computedRunnerSuffix());
        configMap.values().forEach(config -> config.setScriptFile(scriptFilePath));
        configMap.values().forEach(FunctionConfiguration::validate);

        final ObjectWriter objectWriter = getObjectWriter();

        Path rootPath = target.getOutputDirectory().resolve("..");
        Path outputDirectory = target.getOutputDirectory();
        Path functionStagingDir = outputDirectory.resolve(AZURE_FUNCTIONS).resolve(appName.getAppName());

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set quarkus.package.jar.type=legacy-jar in application.properties
  2. Rebuild and redeploy the function after changing the packaging configuration
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions/azure-functions/deployment/src/main/java/io/quarkus/azure/functions/deployment/AzureFunctionsProcessor.java:92 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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