React to the Java plugin being applied rather than always applying it
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import org.gradle.api.Action;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.tasks.compile.JavaCompile;
|
||||
|
||||
import org.springframework.boot.gradle.SpringBootPluginExtension;
|
||||
@@ -42,7 +41,6 @@ public class SpringBootPlugin implements Plugin<Project> {
|
||||
public void apply(Project project) {
|
||||
project.getExtensions().create("springBoot", SpringBootPluginExtension.class,
|
||||
project);
|
||||
project.getPlugins().apply(JavaPlugin.class);
|
||||
new AgentPluginFeatures().apply(project);
|
||||
new RepackagePluginFeatures().apply(project);
|
||||
new RunPluginFeatures().apply(project);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -53,8 +53,10 @@ public class RepackagePluginFeatures implements PluginFeatures {
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
addRepackageTask(project);
|
||||
registerRepackageTaskProperty(project);
|
||||
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
|
||||
addRepackageTask(project);
|
||||
registerRepackageTaskProperty(project);
|
||||
});
|
||||
}
|
||||
|
||||
private void addRepackageTask(Project project) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import org.gradle.api.Action;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.Task;
|
||||
import org.gradle.api.plugins.ExtraPropertiesExtension;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginConvention;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.application.CreateStartScripts;
|
||||
@@ -42,8 +43,10 @@ public class RunPluginFeatures implements PluginFeatures {
|
||||
|
||||
@Override
|
||||
public void apply(Project project) {
|
||||
mainClassNameFinder(project);
|
||||
addBootRunTask(project);
|
||||
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> {
|
||||
mainClassNameFinder(project);
|
||||
addBootRunTask(project);
|
||||
});
|
||||
}
|
||||
|
||||
private void mainClassNameFinder(Project project) {
|
||||
|
||||
Reference in New Issue
Block a user