From 7a565d3d51b400e67ce5643e3f71b9113c194296 Mon Sep 17 00:00:00 2001 From: Steve Hill Date: Fri, 22 Nov 2019 11:07:43 -0800 Subject: [PATCH] Lazily register generate-test-hpl task --- .../org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy b/src/main/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy index 8eaee52c..1dda2606 100644 --- a/src/main/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy +++ b/src/main/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy @@ -400,9 +400,11 @@ class JpiPlugin implements Plugin { SourceSet testSourceSet = javaConvention.sourceSets.getByName(TEST_SOURCE_SET_NAME) // generate test hpl manifest for the current plugin, to be used during unit test - GenerateTestHpl generateTestHpl = project.tasks.create('generate-test-hpl', GenerateTestHpl) - generateTestHpl.hplDir.set(project.layout.buildDirectory.dir('generated-resources/test')) - testSourceSet.output.dir(generateTestHpl.hplDir) + def outputDir = project.layout.buildDirectory.dir('generated-resources/test') + project.tasks.register('generate-test-hpl', GenerateTestHpl) { + it.hplDir.set(outputDir) + } + testSourceSet.output.dir(outputDir) } private static void resolvePluginDependencies(Project project) {