I'm using a file from resources dir, calling it using the code:
XmlDataLoader.class.getClassLoader().getResource("testData").getPath()
It works well on my local machine and the path to the file is correct:
C:/Work/PROJECT_NAME/test/selenium/target/classes/testData
Then I would like it to be used in Jenkins job on the server in linux environment but I get the NullPointerException:
[WARNING] File 'var/lib/jenkins/workspace/project/test/selenium/target/classes/testData/' does not exist
It is because there is a lost "workspace" directory between "project" and "test" folders in the path. The correct path should be:
var/lib/jenkins/workspace/project/ws/test/selenium/target/classes/testData
Required file is really exists there, but for some reason Jenkins build
incorrect path, loosing the /ws/
directory.
Can anyone give me a hand please? Why does class.getClassLoader().getResource("testData").getPath()
doesnt work properly on the server?
I have resources set in Maven pom file:
<resource>
<directory>resources</directory>
</resource>