use of org.springframework.boot.gradle.tasks.buildinfo.BuildInfoProperties in project spring-boot by spring-projects.
the class SpringBootExtension method buildInfo.
/**
* Creates a new {@link BuildInfo} task named {@code bootBuildInfo} and configures the
* Java plugin's {@code classes} task to depend upon it. The task is passed to the
* given {@code configurer} for further configuration.
* <p>
* By default, the task's destination dir will be a directory named {@code META-INF}
* beneath the main source set's resources output directory, and the task's project
* artifact will be the base name of the {@code bootWar} or {@code bootJar} task.
* @param configurer the task configurer
*/
public void buildInfo(Action<BuildInfo> configurer) {
TaskContainer tasks = this.project.getTasks();
TaskProvider<BuildInfo> bootBuildInfo = tasks.register("bootBuildInfo", BuildInfo.class, this::configureBuildInfoTask);
this.project.getPlugins().withType(JavaPlugin.class, (plugin) -> {
tasks.named(JavaPlugin.CLASSES_TASK_NAME).configure((task) -> task.dependsOn(bootBuildInfo));
this.project.afterEvaluate((evaluated) -> bootBuildInfo.configure((buildInfo) -> {
BuildInfoProperties properties = buildInfo.getProperties();
if (properties.getArtifact() == null) {
properties.setArtifact(determineArtifactBaseName());
}
}));
});
if (configurer != null) {
bootBuildInfo.configure(configurer);
}
}
Aggregations