0
在一些单元测试开始,我们用这样的资源链接,java.net.URL
类相对文件系统的URL规范
"https://<host name>/<project name>/pom.xml"
加载测试数据。但是,它在离线开发过程中不起作用。
如何在文件系统中指定相对于test/java
文件夹URL?
我试图"file:///../pom.xml"
,但如果我指定"file://..\\pom.xml"
它带给例外
java.io.FileNotFoundException: \..\pom.xml (The system cannot find the file specified)
我收到
Caused by: java.net.UnknownHostException: ..
尝试'文件:../ pom.xml'。 – EJP
阅读this。我想这就是你要找的。 –