Hi, My test code in Maven project B (which is a child of project A) has something like
String filePath = "src/main/webapp";
//do something with the filePath
The above test case runs fine when I run the project from child (i.e, level B) but when I run from Parent project A (i.e, doing a mvn install at parent level) this fails because obviously there is no folder called "src/main/webapp" under parent level (It is however available in child level).
I know I could do some coding do check if a test case is running from parent/child module but apparently I want to know what others have done when they have had this problem ?
And no, I cant use the classpath instead (for various boring reasons).
I also tried relative path but then the test case sort of starts to know too much. Is there actually a solution at all for this ?
UPDATE (12/Feb) - I have a web.xml under webapp folder and create a jetty server in a test case using that web.xml. Ideally src/main/webapp is not placed in the classpath. It is used by the WAR plugin to package the WAR. Now, I tried an alternative where I put my web.xml in the src/main/resource/console-webapp/WEB-INF/web.xml directory and altered the webXml attribute in the maven war plugin. This seems to solve my problem. However, in the output WAR I have a web.xml and another redundant web.xml (which was copied because it is in the classpath).
I have tried "packageExcludes" and "webResources/excludes" and got the war plugin to omit the second web.xml but still the directory "console-webapp" gets copied (although is empty). Is there any way to tell maven war plugin to ignore a directory completely (i.e, what is the ant pattern for that?)