简体   繁体   English

在Maven自动测试中找不到文件

[英]Can't find a file in maven automatic test

I have a directory in my test folder with all my JavaScript file need for my tests. 我的测试文件夹中有一个目录,其中包含测试所需的所有JavaScript文件。

src/main
src/test
src/test/java
src/test/javascript
src/test/ressources

I have some tests in src/test/java that use some resources in src/test/javascript. 我在src / test / java中进行了一些测试,这些测试使用了src / test / javascript中的一些资源。 It is well working when i launch Junit test manually. 当我手动启动Junit测试时,它运行良好。 But when i launch the Maven test goal. 但是当我启动Maven测试目标时。 i have this : 我有这个 :

 Couldn't read source file "src/test/javascript/envJsOptions.js": src\test\javascript\envJsOptions.js (The system cannot find the path specified)

not sure how you are using js file in junit test 不确定在junit测试中如何使用js文件

but just try using javascript/envJSOptions.js 但只要尝试使用javascript / envJSOptions.js

src/main/java src/main/resources src/test/java src/test/resources src / main / java src / main / resources src / test / java src / test / resources

all these folders can be considered to be in classpath (same level) 所有这些文件夹都可以视为在classpath中(相同级别)

so the paths will be started from that point on, if you are using a resource as stream.. 因此,如果您将资源用作流,则路径将从此点开始。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM