Improve the error message when additional build-info prop has null value

Closes gh-6724
This commit is contained in:
Andy Wilkinson
2016-08-23 11:22:44 +01:00
parent f41e629760
commit 742657983b
2 changed files with 32 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.springframework.boot.loader.tools.BuildPropertiesWriter;
import org.springframework.boot.loader.tools.BuildPropertiesWriter.NullAdditionalPropertyValueException;
import org.springframework.boot.loader.tools.BuildPropertiesWriter.ProjectDetails;
/**
@@ -53,8 +54,8 @@ public class BuildInfoMojo extends AbstractMojo {
private File outputFile;
/**
* Additional properties to store in the build-info.properties. Each entry is prefixed by
* {@code build.} in the generated build-info.properties.
* Additional properties to store in the build-info.properties. Each entry is prefixed
* by {@code build.} in the generated build-info.properties.
*/
@Parameter
private Map<String, String> additionalProperties;
@@ -67,6 +68,10 @@ public class BuildInfoMojo extends AbstractMojo {
this.project.getArtifactId(), this.project.getVersion(),
this.project.getName(), this.additionalProperties));
}
catch (NullAdditionalPropertyValueException ex) {
throw new MojoFailureException(
"Failed to generated build-info.properties. " + ex.getMessage(), ex);
}
catch (Exception ex) {
throw new MojoExecutionException(ex.getMessage(), ex);
}