Could not set unknown property 'testSrcDirs' for Test task in 3.0 M2

It looks like using a plugin built with 2.x has issues when setting testSrcDirs on a Test task.

I get the following error:

Caused by: groovy.lang.MissingPropertyException: Could not set unknown property 'testSrcDirs' for task ':init-plugins:integTest' of type org.gradle.api.tasks.testing.Test.
        at org.gradle.internal.metaobject.AbstractDynamicObject.setMissingProperty(
        at org.gradle.internal.metaobject.ConfigureDelegate.setProperty(
        at com.linkedin.ligradle.testing.plugin.GradleIntegrationTestingPlugin$_addIntegrationTestTask_closure1.doCall(GradleIntegrationTestingPlugin.groovy:65)

Here is the relevant part of the codebase:

def integTest = project.tasks.create('integTest', Test)
integTest.configure {
  shouldRunAfter 'test'
  group = 'Verification'
  description = "Run integration tests"

  reports.junitXml.destination = "$project.buildDir/integration-test-results"
  reports.html.destination = "$project.buildDir/reports/integrationTests"

  testClassesDir = project.sourceSets.integTest.output.classesDir
  classpath = project.sourceSets.integTest.runtimeClasspath
  testSrcDirs = []
  jvmArgs '-Xmx512m', '-XX:MaxPermSize=256m', '-XX:+HeapDumpOnOutOfMemoryError'

Hi Ethan,

Thanks for reporting. I’ve added GRADLE-3506 to be answered for Gradle 3.0.

Hi Ethan,

for 3.0 we removed the support for TestNG source annotations and with this the now unused testSrcDirs property on the test task.

Is this a problem for you?

Hey @Stefan_Wolf,

By TestNG source annotations do you mean @Test on a method in a test class?

No, by TestNG source annotations I mean in the Javadoc like

    * @testng.test 
   public void failingTest() { throw new IllegalArgumentException("broken"); }

Ah I don’t think that will be an issue, but I can check to see if people are using it.