I have got two working directories containing java code and resources, one is for testing and the other one is production.
src/main/java
src/main/resources
src/test/java
src/test/resources
When running my code and reading a file from FileInputStream like this:
new FileInputStream("./someFile.json");
As long a the file is located in the root of the project this works fine. It also works if I have the file in the resource folder and point directly to it like this:
new FileInputStream("src/test/resources/someFile.json");
Is there a way declaring src/test/resources in gradle as the main folder where FileInputStream looks for resources?
If i put my file like this it works fine.
But when I put the file in src/test/java/resources like this
I get a fileNotFoundException.
I need a way to add this directory to be scanned with gradle.
Adding this to build.gradle still throws a fileNotFoundException.
sourceSets {
test {
java {
srcDirs = ['src/test/java']
}
resources {
srcDirs = ['src/test/resources']
}
}
}