Path path = Paths.get("/myproj/somerando.sql");
String sql = new String(Files.readAllBytes(path));
Maven has some conventions, you should try to follow them. These are helpful.
Besides, after development, the application doesn't live in a Maven project but in a component (Jar/war, etc...).
So, to avoid absolute path, you should place your files required for application or testing in matching classpath folders.
if your file is for testing, you could move it to the place reserved by Maven to address this need :
If your file is for the application, you could move it to the place reserved by Maven to address this need :
Now you can access it with :
Path path = Paths.get(YourClass.class.getResource("filter.xml").toURI());