use of org.springframework.boot.gradle.SpringBootPluginExtension in project spring-boot by spring-projects.
the class AgentTasksEnhancer method setup.
private void setup(Project project) {
project.getLogger().info("Configuring agent");
SpringBootPluginExtension extension = project.getExtensions().getByType(SpringBootPluginExtension.class);
this.noverify = extension.getNoverify();
this.agent = getAgent(project, extension);
if (this.agent == null) {
this.agent = getSpringLoadedAgent();
if (this.noverify == null) {
this.noverify = true;
}
}
project.getLogger().debug("Agent: " + this.agent);
}
use of org.springframework.boot.gradle.SpringBootPluginExtension in project spring-boot by spring-projects.
the class RepackageTask method repackage.
@TaskAction
public void repackage() {
Project project = getProject();
SpringBootPluginExtension extension = project.getExtensions().getByType(SpringBootPluginExtension.class);
ProjectLibraries libraries = getLibraries();
project.getTasks().withType(Jar.class, new RepackageAction(extension, libraries));
}
use of org.springframework.boot.gradle.SpringBootPluginExtension in project spring-boot by spring-projects.
the class RepackageTask method getLibraries.
public ProjectLibraries getLibraries() {
Project project = getProject();
SpringBootPluginExtension extension = project.getExtensions().getByType(SpringBootPluginExtension.class);
ProjectLibraries libraries = new ProjectLibraries(project, extension, this.excludeDevtools == null ? extension.isExcludeDevtools() : this.excludeDevtools);
if (extension.getProvidedConfiguration() != null) {
libraries.setProvidedConfigurationName(extension.getProvidedConfiguration());
}
if (this.customConfiguration != null) {
libraries.setCustomConfigurationName(this.customConfiguration);
} else if (extension.getCustomConfiguration() != null) {
libraries.setCustomConfigurationName(extension.getCustomConfiguration());
}
return libraries;
}
use of org.springframework.boot.gradle.SpringBootPluginExtension in project spring-boot by spring-projects.
the class FindMainClassTask method findMainClass.
private String findMainClass() {
Project project = getProject();
String mainClass = null;
// Try the SpringBoot extension setting
SpringBootPluginExtension bootExtension = project.getExtensions().getByType(SpringBootPluginExtension.class);
if (bootExtension.getMainClass() != null) {
mainClass = bootExtension.getMainClass();
}
ApplicationPluginConvention application = (ApplicationPluginConvention) project.getConvention().getPlugins().get("application");
if (mainClass == null && application != null) {
// Try the Application extension setting
mainClass = application.getMainClassName();
}
JavaExec runTask = findRunTask(project);
if (mainClass == null && runTask != null) {
mainClass = runTask.getMain();
}
if (mainClass == null) {
Task bootRunTask = project.getTasks().findByName("bootRun");
if (bootRunTask != null) {
mainClass = (String) bootRunTask.property("main");
}
}
if (mainClass == null) {
// Search
if (this.mainClassSourceSetOutput != null) {
project.getLogger().debug("Looking for main in: " + this.mainClassSourceSetOutput.getClassesDir());
try {
mainClass = MainClassFinder.findSingleMainClass(this.mainClassSourceSetOutput.getClassesDir(), SPRING_BOOT_APPLICATION_CLASS_NAME);
project.getLogger().info("Computed main class: " + mainClass);
} catch (IOException ex) {
throw new IllegalStateException("Cannot find main class", ex);
}
}
}
project.getLogger().info("Found main: " + mainClass);
if (bootExtension.getMainClass() == null) {
bootExtension.setMainClass(mainClass);
}
if (application != null && application.getMainClassName() == null) {
application.setMainClassName(mainClass);
}
if (runTask != null && !runTask.hasProperty("main")) {
runTask.setMain(mainClass);
}
return mainClass;
}
Aggregations