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.
compileJava — JavaCompile. Depends on: All tasks which contribute to the compilation classpath, including jar tasks from projects that are on the classpath via project dependencies. Compiles production Java source files using the JDK compiler.
Class ProcessResourcesCopies resources from their source to their target directory, potentially processing them. Makes sure no stale resources remain in the target directory.
According to Gradle documentation: sourceCompatibility is "Java version compatibility to use when compiling Java source." targetCompatibility is "Java version to generate classes for."
rootDir. The root directory of this project. The root directory is the project directory of the root project.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With