Trying to read a Xml file from webapps
folder. I am using eclipse as IDE.Code is def dir = new File("webapps/WEB-INF/file.txt)
.
This works if I test this class from a main()
but when I run it on Tomcat server it throws FileNotFoundException
because it is trying find the file in Eclipse Installation Directory/webapps/WEB-INF/file.txt
Application is getting deployed at Tomcat installation directory.
Updated Code
def dir = this.class.getResource("webapps/WEB-INF/appEntryXslt/appEntryToSEGRequest")
dir.eachFileRecurse(FileType.FILES) { file ->
//do something with the file
}
But this also did not work. I want to read all the files from a directory.