My project uses Maven with the default folder structure and when my Google Cloud Function is trying to read a JSON file from the resources directory (src/main/resources), it fails with:
File Not Found Exception
Below is my code which is standard to read from the classpath resources folder.
Any hints what could be wrong?
ClassLoader classLoader = getClass().getClassLoader();
URL resource = classLoader.getResource("gcs-sf-dump.sql");
if (resource == null) {
throw new IllegalArgumentException("file is not found!");
} else {
File myFile = new File(resource.getFile());
String query = FileUtils.readFileToString(myFile);
}