{"id":"79f9f805b7f3a770","repo":"spring-projects/spring-boot","slug":"failed-to-generate-build-info-properties","errorCode":null,"errorMessage":"Failed to generate build-info.properties. {}","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/5b2dbdbb8be64415eb6552f81ff7c449c8d251e6/build-plugin/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/BuildInfoMojo.java#L110-L146","documentation":"Thrown by BuildInfoMojo.execute as a MojoFailureException when BuildPropertiesWriter throws NullAdditionalPropertyValueException — i.e. an entry in <additionalProperties> has a null value (or a value that resolves to null) and cannot be written to build-info.properties. The message is the concatenation of the static prefix and the exception's message (the original error message is preserved in the {}-equivalent suffix). This is a configuration error: Maven plugin parameters do not allow null String values normally, but property interpolation or programmatic configuration can produce them.","triggerScenarios":"Declaring <additionalProperties><build.commit>${git.commit.id}</build.commit></additionalProperties> when the git.commit.id property is not defined and Maven leaves the literal or returns null; using a CI-injected property that was never set; a flattened POM or filtering step strips the value.","commonSituations":"Integrating git-commit-id-plugin properties that are not yet available at GENERATE_RESOURCES; referencing a property that only exists on certain CI branches; misspelling a property name in additionalProperties; resource filtering replacing the value with null.","solutions":["Set a default value for the referenced property, e.g. ${git.commit.id:unknown}.","Ensure any upstream plugin (git-commit-id-maven-plugin) that supplies the property runs before the build-info goal.","Remove the offending entry from <additionalProperties> if the value is genuinely optional, or exclude it via excludeInfoProperties.","Run with -X to see which additional property produced the NullAdditionalPropertyValueException."],"exampleFix":"// before\n<additionalProperties>\n  <build.commit>${git.commit.id}</build.commit>\n</additionalProperties>\n// after — default value\n<additionalProperties>\n  <build.commit>${git.commit.id:unknown}</build.commit>\n</additionalProperties>","handlingStrategy":"validation","validationCode":"// Verify additional properties resolve to non-null before build-info\nimport java.util.Map;\n\nvoid assertNoNullValues(Map<String,String> additional, java.util.Properties props) {\n    for (var e : additional.entrySet()) {\n        String v = e.getValue();\n        if (v == null || (v.startsWith(\"${\") && props.getProperty(strip(v))) == null) {\n            throw new IllegalArgumentException(\"additionalProperty '\" + e.getKey() + \"' resolves to null\");\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide defaults for any property referenced in <additionalProperties> via ${name:default}.","Ensure upstream plugins that supply values (git-commit-id, etc.) run before the build-info goal.","Use excludeInfoProperties to drop values that are not guaranteed to exist."],"tags":["maven","spring-boot","build-info","configuration","properties"],"analyzedSha":"5b2dbdbb8be64415eb6552f81ff7c449c8d251e6","analyzedAt":"2026-08-04T18:53:14.967Z","schemaVersion":2}