views:

84

answers:

1

My Maven build is failing on Hudson with a FileNotFoundException, I do not get the same failure through NetBeans. The FileNotFoundException is for some xml files in the same packages as my test classes themselves. It would appear these are not getting copied as part of the build in the same way the class files are. Do I have to add something to my POM for the xml files to be copied?

If any more information is required please let me know, I wanted to keep the question short incase it was something simple.

A: 

My Maven build is failing on Hudson with a FileNotFoundException, I do not get the same failure through NetBeans.

That's possible and you should always run Maven before to commit. Having code that compile under your IDE is not enough, the Maven build is the "master".

The FileNotFoundException is for some xml files in the same packages as my test classes themselves

If your XML files are located next to you tests classes in src/test/java, then they won't get copied to target/test-classes. Test resources should go in src/test/resources if you want them to end up in target/test-classes.

Pascal Thivent
What if the xml files are only required for test? They will end up in the release build as well if I put them in resources.
James
@James `src/test/resources` is for resources required by tests (there was a typo in my answer, I fixed it), they won't get bundled in the final jar.
Pascal Thivent