I am trying to unit test a webapp that I am developing in Maven/Eclipse. It is a Spring MVC webapp, and I need some unit tests to test my model controller.
To do this, I need to use my webapp config .xml files to inject the controller, however, all my configuration (and other associated files that the configs reference) are in the src/main/webapp directory (as per Maven convention) - there are a lot of files in here that i need to reference in my tests, but they are not available when running the test as they are not on the classpath (Maven only seems to be adding src/main/java, src/test/java, src/main/resources, src/test/resources to the classpath but not src/main/webapps)
I do not want to have to copy my entire webapp in to my src/test/resources folder just for the purpose of testing - is there any other way to be able to access them?
I can get around this by changing the Eclipse "Run Configurations" to include this folder on the classpath, but that will not work when running the tests from the command line?
Has anyone else encountered this? is there a know solution?
Thanks!