Monday, May 25, 2009

How to refer to a file resource in test when using Maven

Just do this, and it will work both in the IDE and in continuous integration:

  1. Stick the file in the "test/resources" folder
  2. File test = new File(getClass().getResource("/test.txt").getFile());


Thanks go to James and Google.

0 comments: