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 eb73ce46..976dbad2 100644 --- a/src/main/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy +++ b/src/main/groovy/org/jenkinsci/gradle/plugins/jpi/JpiPlugin.groovy @@ -422,10 +422,13 @@ class JpiPlugin implements Plugin { // generate test hpl manifest for the current plugin, to be used during unit test def outputDir = project.layout.buildDirectory.dir('generated-resources/test') - project.tasks.register('generate-test-hpl', GenerateTestHpl) { + testSourceSet.output.dir(outputDir) + + def generateTestHplTask = project.tasks.register('generate-test-hpl', GenerateTestHpl) { it.hplDir.set(outputDir) } - testSourceSet.output.dir(outputDir) + + project.tasks.named(JavaPlugin.TEST_CLASSES_TASK_NAME).configure { it.dependsOn(generateTestHplTask) } } private static void resolvePluginDependencies(Project project) { diff --git a/src/test/groovy/org/jenkinsci/gradle/plugins/jpi/JpiIntegrationSpec.groovy b/src/test/groovy/org/jenkinsci/gradle/plugins/jpi/JpiIntegrationSpec.groovy index aca70047..b62c85a9 100644 --- a/src/test/groovy/org/jenkinsci/gradle/plugins/jpi/JpiIntegrationSpec.groovy +++ b/src/test/groovy/org/jenkinsci/gradle/plugins/jpi/JpiIntegrationSpec.groovy @@ -166,6 +166,7 @@ class JpiIntegrationSpec extends IntegrationSpec { 'processTestResources' | ':resolveTestDependencies' | TaskOutcome.NO_SOURCE 'jpi' | ':war' | TaskOutcome.SUCCESS 'compileTestJava' | ':insertTest' | TaskOutcome.SKIPPED + 'testClasses' | ':generate-test-hpl' | TaskOutcome.SUCCESS 'compileJava' | ':localizer' | TaskOutcome.SUCCESS }