Tell Gradle to check two directories for the main Java source

I have a project full of tests that we use to query our environment. We are running these tests with Gradle. I would like to run these tests from a separate application in order to get rid of Gradle dependencies. I am using the Gradle plugin 'application and am trying to run JUnit tests using JUnitCore and everything is fine, except that I cannot access my test classes from the main one.

I have

--main
--smokeTest
--longRunningTest

      

When I say Gradle 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 cursor and longRunningTest.

+3


source to share


1 answer


Don't steal the flame from @ david-m-karr just by specifying a little:

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

      



can work

+4


source







All Articles