I am having a problems running the following code:
configService.setMainConfig("src/test/resources/MainConfig.xml");
From within a Junit @Before method.
Is this the way Maven builds out its target folder?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Access
MainConfig.xmldirectly. Thesrc/test/resourcesdirectory contents are placed in the root of your CLASSPATH.More precisely: contents of
src/test/resourcesare copied intotarget/test-classes, so if you have the following project structure:It will result with the following test CLASSPATH contents:
/foo/C.class/a.xml/foo/b.xmlTo actually access the files from Java source, use
getClass().getResource("/MainConfig.xml").getFile().