I have a project that uses the normal Maven structure, e.g.
module
\\ src
\\ main
- java
- resources
\\ test
- java
- resources
Just for completeness, wanted to point out the way to get this without having to grab the current instance of the ClassLoader
, using ClassLoader#getSystemResource. This example does the work without having to place a file at the top.
//Obtains the folder of /src/test/resources
URL url = ClassLoader.getSystemResource("");
File folder = new File(url.toURI());
//List contents...