I have a maven project which is build and tested in Jenkins. On my local machine the tests run successful but in Jenkins a file cannot be loaded which is needed by the test. I use this.getClass.getResourceAsStream("testfile.dat")
to load the resource. It seems that Jenkins doesn't copy the resource files to the directory the tests are running in. Is that a maven problem? How do I advice Jenkins/Maven to copy the resources to the test classpath?
Put your test resources in the src/test/resources
tree of your Maven project. Maven will ensure that they are on the classpath when your tests are run, and hence that they can be found using getResourceAsStream(...)
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With