|
|
@ -22,10 +22,12 @@ import java.util.Map;
|
|
|
|
import org.apache.maven.plugin.AbstractMojo;
|
|
|
|
import org.apache.maven.plugin.AbstractMojo;
|
|
|
|
import org.apache.maven.plugin.MojoExecutionException;
|
|
|
|
import org.apache.maven.plugin.MojoExecutionException;
|
|
|
|
import org.apache.maven.plugin.MojoFailureException;
|
|
|
|
import org.apache.maven.plugin.MojoFailureException;
|
|
|
|
|
|
|
|
import org.apache.maven.plugins.annotations.Component;
|
|
|
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
|
|
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
|
|
|
import org.apache.maven.plugins.annotations.Mojo;
|
|
|
|
import org.apache.maven.plugins.annotations.Mojo;
|
|
|
|
import org.apache.maven.plugins.annotations.Parameter;
|
|
|
|
import org.apache.maven.plugins.annotations.Parameter;
|
|
|
|
import org.apache.maven.project.MavenProject;
|
|
|
|
import org.apache.maven.project.MavenProject;
|
|
|
|
|
|
|
|
import org.sonatype.plexus.build.incremental.BuildContext;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.boot.loader.tools.BuildPropertiesWriter;
|
|
|
|
import org.springframework.boot.loader.tools.BuildPropertiesWriter;
|
|
|
|
import org.springframework.boot.loader.tools.BuildPropertiesWriter.NullAdditionalPropertyValueException;
|
|
|
|
import org.springframework.boot.loader.tools.BuildPropertiesWriter.NullAdditionalPropertyValueException;
|
|
|
@ -41,6 +43,9 @@ import org.springframework.boot.loader.tools.BuildPropertiesWriter.ProjectDetail
|
|
|
|
@Mojo(name = "build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true)
|
|
|
|
@Mojo(name = "build-info", defaultPhase = LifecyclePhase.GENERATE_RESOURCES, threadSafe = true)
|
|
|
|
public class BuildInfoMojo extends AbstractMojo {
|
|
|
|
public class BuildInfoMojo extends AbstractMojo {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Component
|
|
|
|
|
|
|
|
private BuildContext buildContext;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* The Maven project.
|
|
|
|
* The Maven project.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -67,6 +72,7 @@ public class BuildInfoMojo extends AbstractMojo {
|
|
|
|
.writeBuildProperties(new ProjectDetails(this.project.getGroupId(),
|
|
|
|
.writeBuildProperties(new ProjectDetails(this.project.getGroupId(),
|
|
|
|
this.project.getArtifactId(), this.project.getVersion(),
|
|
|
|
this.project.getArtifactId(), this.project.getVersion(),
|
|
|
|
this.project.getName(), this.additionalProperties));
|
|
|
|
this.project.getName(), this.additionalProperties));
|
|
|
|
|
|
|
|
this.buildContext.refresh(this.outputFile);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (NullAdditionalPropertyValueException ex) {
|
|
|
|
catch (NullAdditionalPropertyValueException ex) {
|
|
|
|
throw new MojoFailureException(
|
|
|
|
throw new MojoFailureException(
|
|
|
|