Reacting to Spring Boot plugin code needs to wait until Java plugin is applied
@@ -11,6 +11,7 @@ import org.gradle.api.Task
import org.gradle.api.file.Directory
import org.gradle.api.plugins.BasePlugin
import org.gradle.api.plugins.ExtensionAware
+import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Sync
import org.gradle.api.tasks.bundling.Jar
@@ -36,6 +37,7 @@ class DockerSpringBootApplicationPlugin implements Plugin<Project> {
DockerExtension dockerExtension = project.extensions.getByType(DockerExtension)
DockerSpringBootApplication dockerSpringBootApplication = configureExtension(project, dockerExtension)
+ project.plugins.withType(JavaPlugin) {
project.plugins.withId('org.springframework.boot') {
Jar archiveTask = determineArchiveTask(project)
Dockerfile createDockerfileTask = createDockerfileTask(project, archiveTask, dockerSpringBootApplication)
@@ -45,6 +47,7 @@ class DockerSpringBootApplicationPlugin implements Plugin<Project> {
createPushImageTask(project, dockerBuildImageTask)
}
}
+ }
private static Jar determineArchiveTask(Project project) {
Task bootWarTask = project.tasks.findByName(BOOT_WAR_TASK_NAME)
