James Raitsev
James Raitsev

Reputation: 96521

Maven: accessing resources

One my the mock up testing files i have is loaded by

file = new TestData("src/main/resources/sample.json");

Unfortunately it is not found, while it is there.

In Maven project, is path i am using correct?

Upvotes: 2

Views: 3582

Answers (1)

Charlee Chitsuk
Charlee Chitsuk

Reputation: 9069

After the project is compiled or packaged, the resources which is stored at the "src/main/resources" will be collected and put to the default package.

You may see further details as the following path/file.

  1. target[your_project].jar
  2. target\classes\

If you would like to access them, please use only their name, e.g. "sample.json".

I hope this may help to clarify your issue.

Regards,

Charlee Ch.

Upvotes: 4

Related Questions