GoogleContainerTools/jib · error · UnsupportedOperationException

packaged containerizing mode for WAR is not yet supported

Error message

packaged containerizing mode for WAR is not yet supported

What it means

Jib's containerizingMode option can be 'exploded' or 'packaged'; 'packaged' places the built artifact as a single file. getContainerizingModeChecked rejects containerizingMode=packaged on WAR projects with UnsupportedOperationException because packaging a WAR as a single file in the container is not yet implemented.

Source

Thrown at jib-plugins-common/src/main/java/com/google/cloud/tools/jib/plugins/common/PluginConfigurationProcessor.java:878

    if (appRoot.isEmpty()) {
      appRoot =
          projectProperties.isWarProject()
              ? DEFAULT_JETTY_APP_ROOT
              : JavaContainerBuilder.DEFAULT_APP_ROOT;
    }
    try {
      return AbsoluteUnixPath.get(appRoot);
    } catch (IllegalArgumentException ex) {
      throw new InvalidAppRootException(appRoot, appRoot, ex);
    }
  }

  static ContainerizingMode getContainerizingModeChecked(
      RawConfiguration rawConfiguration, ProjectProperties projectProperties)
      throws InvalidContainerizingModeException {
    ContainerizingMode mode = ContainerizingMode.from(rawConfiguration.getContainerizingMode());
    if (mode == ContainerizingMode.PACKAGED && projectProperties.isWarProject()) {
      throw new UnsupportedOperationException(
          "packaged containerizing mode for WAR is not yet supported");
    }
    return mode;
  }

  @VisibleForTesting
  static Optional<AbsoluteUnixPath> getWorkingDirectoryChecked(RawConfiguration rawConfiguration)
      throws InvalidWorkingDirectoryException {
    Optional<String> directory = rawConfiguration.getWorkingDirectory();
    if (!directory.isPresent()) {
      return Optional.empty();
    }

    String path = directory.get();
    try {
      return Optional.of(AbsoluteUnixPath.get(path));
    } catch (IllegalArgumentException ex) {
      throw new InvalidWorkingDirectoryException(path, path, ex);

View on GitHub (pinned to fb949e2676)

Solutions

  1. Switch to containerizingMode='exploded' for WAR projects (the supported mode for WARs).
  2. Only apply the packaged mode in non-WAR modules, e.g. guard the setting with 'if (!project.plugins.hasPlugin(WarPlugin))'.
  3. Remove the containerizingMode line entirely to use the default mode appropriate for the project type.

Example fix

// before (build.gradle of a WAR module)
jib.containerizingMode = 'packaged'
// after
jib.containerizingMode = 'exploded'
Defensive patterns

Strategy: type-guard

Validate before calling

// Gradle: guard packaged mode for WAR projects
if (jib.containerizingMode.get() == 'packaged' && plugins.hasPlugin('war')) {
  throw new IllegalArgumentException("containerizingMode=packaged is unsupported for WAR projects");
}

Try / catch

try {
  jibContainerBuilder = processor.processCommonConfiguration(...);
} catch (UnsupportedOperationException e) {
  logger.error("Use containerizingMode=exploded for WAR projects: " + e.getMessage());
}

Prevention

When it happens

Trigger: processCommonConfiguration -> getContainerizingModeChecked when ContainerizingMode.from(...) resolves to PACKAGED while projectProperties.isWarProject() is true (Maven <packaging>war</packaging> or Gradle war plugin).

Common situations: Users with a WAR project (or a project applying the war plugin alongside jar) set jib.containerizingMode='packaged' expecting a single WAR deployed like a jar; shared build scripts that set packaged mode for all modules in a multi-module build.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/f86bec6965bf2f7f. Report an issue: GitHub.