I'm working on a maven modular project that has a structure that look like at the following:
|-- parent
|-- model
--pom.xml
|-- services
--pom.xml
|-- web-app
--pom.xml
No in my service module I have some resources in src/main/resources. But when i try to get them:
String fileName = getClass().getResource("/myFile.txt").getPath();
map.put("myReport",JasperCompileManager.compileReport(fileName));
the file name has the following value
file:/home/myUser/apache-tomcat-8.0.3/webapps/myApp/WEB-INF/lib/services-0.0.1-SNAPSHOT.jar!/myFile.txt
and then when i try to use it i get :
Caused by: java.io.FileNotFoundException: file:/home/myUser/apache-tomcat-8.0.3/webapps/myApp/WEB-INF/lib/services-0.0.1-SNAPSHOT.jar!/myFile.txt
Also i saw others post (not resolved) like Get file in the resources folder in Java where somebody said the is not possible to get resource from different modules.
Is this true? How can I do to fix it?