techgnosis
techgnosis

Reputation: 2039

Tell Gradle to check two directories for main java source code

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.

Upvotes: 7

Views: 9143

Answers (1)

judoole
judoole

Reputation: 1422

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

Upvotes: 13

Related Questions