GoogleContainerTools/jib · error · MojoFailureException

Missing target image parameter <HelpfulSuggestions.forToNotC

Error message

Missing target image parameter <HelpfulSuggestions.forToNotConfigured for <to><image> in pom.xml: mvn compile jib:build -Dimage=<your image name>>

What it means

BuildImageMojo.execute() requires a target image reference (<to><image>) to know where to push the built image. When getTargetImage() is null or empty it throws a MojoFailureException built from HelpfulSuggestions.forToNotConfigured, which includes the exact mvn command to supply the image on the command line.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java:84

    if (MojoCommon.shouldSkipJibExecution(this)) {
      return;
    }

    // Validates 'format'.
    if (Arrays.stream(ImageFormat.values()).noneMatch(value -> value.name().equals(getFormat()))) {
      throw new MojoFailureException(
          "<format> parameter is configured with value '"
              + getFormat()
              + "', but the only valid configuration options are '"
              + ImageFormat.Docker
              + "' and '"
              + ImageFormat.OCI
              + "'.");
    }

    // Parses 'to' into image reference.
    if (Strings.isNullOrEmpty(getTargetImage())) {
      throw new MojoFailureException(
          HelpfulSuggestions.forToNotConfigured(
              "Missing target image parameter",
              "<to><image>",
              "pom.xml",
              "mvn compile jib:build -Dimage=<your image name>"));
    }

    MavenSettingsProxyProvider.activateHttpAndHttpsProxies(
        getSession().getSettings(), getSettingsDecrypter());

    TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider();
    MavenProjectProperties projectProperties =
        MavenProjectProperties.getForProject(
            Preconditions.checkNotNull(descriptor),
            getProject(),
            getSession(),
            getLog(),
            tempDirectoryProvider,

View on GitHub (pinned to fb949e2676)

Solutions

  1. Add <to><image>registry/repo/name:tag</image></to> to the jib-maven-plugin configuration in pom.xml.
  2. Pass the target image on the command line: mvn compile jib:build -Dimage=<your image name>.
  3. Set the property backing <to><image> (e.g. -Djib.to.image=... or a pom property) in your CI environment.

Example fix

<!-- before -->
<configuration>
  <from><image>openjdk:17</image></from>
</configuration>
<!-- after -->
<configuration>
  <from><image>openjdk:17</image></from>
  <to><image>gcr.io/my-project/my-app:1.0</image></to>
</configuration>
Defensive patterns

Strategy: validation

Validate before calling

String target = pomImage != null ? pomImage : System.getProperty("image");
if (target == null || target.isEmpty()) {
  throw new IllegalStateException("Missing target image: set <to><image> in pom.xml or pass -Dimage=<name>");
}

Try / catch

catch (MojoFailureException e) { System.err.println(e.getMessage()); /* supply -Dimage or <to><image> */ }

Prevention

When it happens

Trigger: Running 'mvn compile jib:build' (or jib:buildTar) with no <to><image> in pom.xml and no -Dimage=... system property; the property holder <to>/targetImage resolving to an empty string.

Common situations: First-time jib:build usage without configuring the registry image name; CI pipelines missing the -Dimage parameter; pom property interpolation resolving to empty.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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