Grails测试目录的相对路径 [英] Relative Path to Grails test Directory

查看:121
本文介绍了Grails测试目录的相对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在测试目录下创建了一个文件夹来存储我们测试所需的一些文件。我如何通过相对路径访问此目录?我查看了GrailsResourceUtils,但它似乎只处理grails-app目录。

I created a folder under the test directory to store some files needed for our tests. How can I access this directory via a relative path? I looked into the GrailsResourceUtils but it seems to only deal with the grails-app directory.

例如,我需要访问以下内容:

For example, I need to access something like:

test/artifacts/file.txt


推荐答案

嗯,它看起来像那个确切的路径一样简单:

Hm, it would seem this was as easy as that exact path:

new File("test/artifacts/file.txt")

解决得很好。

这篇关于Grails测试目录的相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆