diff --git a/java-generator/gradle-plugin/src/main/java/io/fabric8/java/generator/gradle/plugin/JavaGeneratorPlugin.java b/java-generator/gradle-plugin/src/main/java/io/fabric8/java/generator/gradle/plugin/JavaGeneratorPlugin.java index a7ac67b114a..5830bef54ef 100644 --- a/java-generator/gradle-plugin/src/main/java/io/fabric8/java/generator/gradle/plugin/JavaGeneratorPlugin.java +++ b/java-generator/gradle-plugin/src/main/java/io/fabric8/java/generator/gradle/plugin/JavaGeneratorPlugin.java @@ -23,7 +23,7 @@ public class JavaGeneratorPlugin implements Plugin { @Override public void apply(Project project) { // create an extension for the plugin - project.getExtensions().create(JavaGeneratorPluginExtension.NAME, JavaGeneratorPluginExtension.class, project); + project.getExtensions().create(JavaGeneratorPluginExtension.NAME, JavaGeneratorPluginExtension.class); // register tasks project.getTasks().register(JavaGeneratorCrd2JavaTask.NAME, JavaGeneratorCrd2JavaTask.class, JavaGeneratorPluginExtension.class); diff --git a/java-generator/gradle-plugin/src/main/java/io/fabric8/java/generator/gradle/plugin/JavaGeneratorPluginExtension.java b/java-generator/gradle-plugin/src/main/java/io/fabric8/java/generator/gradle/plugin/JavaGeneratorPluginExtension.java index efd05a318c8..da272545e0d 100644 --- a/java-generator/gradle-plugin/src/main/java/io/fabric8/java/generator/gradle/plugin/JavaGeneratorPluginExtension.java +++ b/java-generator/gradle-plugin/src/main/java/io/fabric8/java/generator/gradle/plugin/JavaGeneratorPluginExtension.java @@ -18,6 +18,7 @@ import io.fabric8.java.generator.Config; import org.gradle.api.Project; import org.gradle.api.file.DirectoryProperty; +import org.gradle.api.file.ProjectLayout; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.ListProperty; @@ -29,12 +30,12 @@ public abstract class JavaGeneratorPluginExtension { public static final String NAME = "javaGen"; - protected Project gradleProject; + protected final ProjectLayout layout; private Config javaGeneratorConfig = Config.builder().build(); - public JavaGeneratorPluginExtension(Project gradleProject) { - this.gradleProject = gradleProject; + public JavaGeneratorPluginExtension(ProjectLayout layout) { + this.layout = layout; } public Config getConfig() { @@ -68,7 +69,7 @@ public List getUrlsOrDefault() { public File getDownloadTargetOrDefault() { return this.getDownloadTarget().getAsFile() - .getOrElse(this.gradleProject.getLayout().getProjectDirectory() + .getOrElse(layout.getProjectDirectory() .dir("build") .dir("crds") .getAsFile()); @@ -82,7 +83,7 @@ public File getDownloadTargetOrDefault() { public File getTargetOrDefault() { return this.getTarget().getAsFile() - .getOrElse(this.gradleProject.getLayout().getProjectDirectory() + .getOrElse(layout.getProjectDirectory() .dir("build") .dir("generated") .dir("sources").getAsFile());