7

I have a project full of tests that we use to query our environments. We run these tests using Gradle. I would like to run these tests from a standalone application to get rid of the Gradle dependency. I am using the gradle 'application' plugin and trying to run the JUnit tests using JUnitCore and everything is fine except I can't access my test classes from main.

I have

--main
--smokeTest
--longRunningTest

When I tell Gradle this it doesn't work.

sourceSets {
 main {
    java { srcDirs ['src/main/java', 'src/smokeTest/java'] }
    }
} 

It says "main" is not a recognized function. The java plugin is installed because I already have entries to define smokeTest and longRunningTest.

techgnosis
  • 1,879
  • 2
  • 17
  • 19

1 Answers1

13

Not to steal the flame from @david-m-karr, just refining a bit:

sourceSets.main.java.srcDirs = ['src/main/java', 'src/smokeTest/java'] 

might work

judoole
  • 1,382
  • 2
  • 10
  • 20
  • Writing a proper answer is preferred in this case, so upvoting this - it's also much clearer to read an example given in an answer than in a comment. – Per Lundberg Nov 20 '18 at 07:13