J. H
J. H

Reputation: 124

Jenkins says he does not found a json file, but the file is there

I want to execute JUnit Tests with Jenkins. And in one of the Tests I load a json file from src/test/resources.

Locally the test is working on windows (and mac). But jenkins says that the file is missing. So I checked it on the server, but this file was there.

I tried a "sudo chmod 775 -R "on the full workspace directory including subdirectories.

java.nio.file.NoSuchFileException: /var/lib/jenkins/workspace/a-project/java-framework/tests/junit/project-test/target/test-classes/testfolder/report.json

So I don't know how to solve it. Is it a Linux problem or is it about rights ? Maybe somebody has a tip. The only solution I know is to save the json as a String in the test class.

Upvotes: 0

Views: 1407

Answers (1)

J. H
J. H

Reputation: 124

URLDecoder.decode(getClass().getResource(fileName).getFile(), "UTF-8")

was the solution! Thank you Milan!

Upvotes: 1

Related Questions