I am new to Gradle and I have a source code location different than what Gradle expects.
Gradle expects to find the production source code under src/main/java
and your test source code under src/main/resources
. How do I configure Gradle to a different source code?
You have to add few lines to build.gradle
:
To replace the default source folders, you will want to use srcDirs instead, which takes an array of the path.
sourceSets {
main.java.srcDirs = ['src/java']
main.resources.srcDirs = ['src/resources']
}
Another way of doing it is:
sourceSets {
main {
java {
srcDir 'src/java'
}
resources {
srcDir 'src/resources'
}
}
}
The same thing is applicable to test folder too.