{"record":{"id":"f8703cc982abfd62","repo":"GoogleContainerTools/jib","slug":"missing-target-image-parameter-helpfulsuggestions","errorCode":null,"errorMessage":"Missing target image parameter <HelpfulSuggestions.forToNotConfigured for <to><image> in pom.xml: mvn compile jib:build -Dimage=<your image name>>","messagePattern":"Missing target image parameter <HelpfulSuggestions\\.forToNotConfigured for <to><image> in pom\\.xml: mvn compile jib:build -Dimage=<your image name>>","errorType":"validation","errorClass":"MojoFailureException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java","lineNumber":84,"sourceCode":"    if (MojoCommon.shouldSkipJibExecution(this)) {\n      return;\n    }\n\n    // Validates 'format'.\n    if (Arrays.stream(ImageFormat.values()).noneMatch(value -> value.name().equals(getFormat()))) {\n      throw new MojoFailureException(\n          \"<format> parameter is configured with value '\"\n              + getFormat()\n              + \"', but the only valid configuration options are '\"\n              + ImageFormat.Docker\n              + \"' and '\"\n              + ImageFormat.OCI\n              + \"'.\");\n    }\n\n    // Parses 'to' into image reference.\n    if (Strings.isNullOrEmpty(getTargetImage())) {\n      throw new MojoFailureException(\n          HelpfulSuggestions.forToNotConfigured(\n              \"Missing target image parameter\",\n              \"<to><image>\",\n              \"pom.xml\",\n              \"mvn compile jib:build -Dimage=<your image name>\"));\n    }\n\n    MavenSettingsProxyProvider.activateHttpAndHttpsProxies(\n        getSession().getSettings(), getSettingsDecrypter());\n\n    TempDirectoryProvider tempDirectoryProvider = new TempDirectoryProvider();\n    MavenProjectProperties projectProperties =\n        MavenProjectProperties.getForProject(\n            Preconditions.checkNotNull(descriptor),\n            getProject(),\n            getSession(),\n            getLog(),\n            tempDirectoryProvider,","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java#L66-L102","documentation":"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.","triggerScenarios":"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.","commonSituations":"First-time jib:build usage without configuring the registry image name; CI pipelines missing the -Dimage parameter; pom property interpolation resolving to empty.","solutions":["Add <to><image>registry/repo/name:tag</image></to> to the jib-maven-plugin configuration in pom.xml.","Pass the target image on the command line: mvn compile jib:build -Dimage=<your image name>.","Set the property backing <to><image> (e.g. -Djib.to.image=... or a pom property) in your CI environment."],"exampleFix":"<!-- before -->\n<configuration>\n  <from><image>openjdk:17</image></from>\n</configuration>\n<!-- after -->\n<configuration>\n  <from><image>openjdk:17</image></from>\n  <to><image>gcr.io/my-project/my-app:1.0</image></to>\n</configuration>","handlingStrategy":"validation","validationCode":"String target = pomImage != null ? pomImage : System.getProperty(\"image\");\nif (target == null || target.isEmpty()) {\n  throw new IllegalStateException(\"Missing target image: set <to><image> in pom.xml or pass -Dimage=<name>\");\n}","typeGuard":null,"tryCatchPattern":"catch (MojoFailureException e) { System.err.println(e.getMessage()); /* supply -Dimage or <to><image> */ }","preventionTips":["Always configure <to><image> in the jib-maven-plugin <configuration>","Parameterize the image name via a pom property (e.g. ${image.name}) set per-environment","Add a CI preflight check that the image property is non-empty"],"tags":["maven","jib","configuration","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}