{"record":{"id":"f7b041d57b26f916","repo":"spring-projects/spring-boot","slug":"failed-to-generate-build-info-properties-ex-getm","errorCode":null,"errorMessage":"Failed to generate build-info.properties. {ex.getMessage()}","messagePattern":"Failed to generate build-info\\.properties\\. (.+?)","errorType":"exception","errorClass":"MojoFailureException","httpStatus":null,"severity":"error","filePath":"build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java","lineNumber":128,"sourceCode":"\n\t@Inject\n\tpublic BuildInfoMojo(BuildContext buildContext) {\n\t\tthis.buildContext = buildContext;\n\t}\n\n\t@Override\n\tpublic void execute() throws MojoExecutionException, MojoFailureException {\n\t\tif (this.skip) {\n\t\t\tgetLog().debug(\"skipping build-info as per configuration.\");\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tProjectDetails details = getProjectDetails();\n\t\t\tnew BuildPropertiesWriter(this.outputFile).writeBuildProperties(details);\n\t\t\tthis.buildContext.refresh(this.outputFile);\n\t\t}\n\t\tcatch (NullAdditionalPropertyValueException ex) {\n\t\t\tthrow new MojoFailureException(\"Failed to generate build-info.properties. \" + ex.getMessage(), ex);\n\t\t}\n\t\tcatch (Exception ex) {\n\t\t\tthrow new MojoExecutionException(ex.getMessage(), ex);\n\t\t}\n\t}\n\n\tprivate ProjectDetails getProjectDetails() {\n\t\tString group = getIfNotExcluded(\"group\", this.project.getGroupId());\n\t\tString artifact = getIfNotExcluded(\"artifact\", this.project.getArtifactId());\n\t\tString version = getIfNotExcluded(\"version\", this.project.getVersion());\n\t\tString name = getIfNotExcluded(\"name\", this.project.getName());\n\t\tInstant time = getIfNotExcluded(\"time\", getBuildTime());\n\t\tMap<String, String> additionalProperties = applyExclusions(this.additionalProperties);\n\t\treturn new ProjectDetails(group, artifact, version, name, time, additionalProperties);\n\t}\n\n\tprivate <T> @Nullable T getIfNotExcluded(String name, @Nullable T value) {\n\t\treturn (this.excludeInfoProperties == null || !this.excludeInfoProperties.contains(name)) ? value : null;","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java#L110-L146","documentation":"MojoFailureException (a build-logic failure, not infrastructure) thrown by BuildInfoMojo.execute when BuildPropertiesWriter rejects a null additional property value via NullAdditionalPropertyValueException. The message includes the underlying exception's text, so the offending property name is visible. Other exceptions fall through to a generic MojoExecutionException in the next catch.","triggerScenarios":"Declaring <additionalProperties> with a value that resolves to null, e.g. referencing a missing Maven property, a ${...} that doesn't exist, or programmatically injecting null. BuildPropertiesWriter throws NullAdditionalPropertyValueException to refuse emitting an incomplete build-info.properties.","commonSituations":"Using <additionalProperties><property>${env.UNSET_VAR}</property></additionalProperties> with an unset environment variable; referencing a property only defined in a profile that isn't active; CI environment missing a variable that's set locally.","solutions":["Read ex.getMessage() — it names the property whose value is null.","Provide a default: ${env.UNSET_VAR:-default} (via a properties plugin) or set the environment variable in CI.","Activate the profile that defines the property, or remove the entry if the value is optional.","Run with -X to see the resolved property values during build-info."],"exampleFix":"// before: <additionalProperties><scmRevision>${env.GIT_COMMIT}</scmRevision></additionalProperties>   (env var unset)\n// after:  <scmRevision>${git.commit.id}</scmRevision>   (via git-commit-id-plugin, always populated)","handlingStrategy":"validation","validationCode":"// Resolve every <additionalProperties> value to non-null before the goal:\nMap<String,String> additional = /* from config */;\nfor (Map.Entry<String,String> e : additional.entrySet()) {\n    if (e.getValue() == null) {\n        throw new IllegalArgumentException(\"build-info additional property '\" + e.getKey() + \"' resolved to null\");\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    // invoke build-info\n} catch (MojoFailureException ex) { // MojoFailureException, not MojoExecutionException\n    if (ex.getMessage().startsWith(\"Failed to generate build-info.properties\")) {\n        // a null additional property — read ex.getMessage() for the name\n    }\n    throw ex;\n}","preventionTips":["Reference only Maven properties / env vars guaranteed to be set.","Use git-commit-id-plugin or similar instead of raw ${env.*} for SCM values.","Test build-info locally in CI before deploying."],"tags":["spring-boot","maven-plugin","build-info","properties","configuration"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}