My test code in the Maven B project (which is a child of Project A) has something like
String filePath = "src/main/webapp";
The above test script works fine when I start a project from a child (i.e. level B), but when I start from a parent project A (i.e., by performing mvn installation at the parent level), it fails, because obviously not folders called "src / main / webapp" under the parent level (however, it is available at the child level).
I know that I can do some encoding, check if the test case works from the parent / child module, but apparently I want to know what others did when they had this problem?
And no, I cannot use classpath instead (for various reasons).
I also tried the relative path, but then the type of test case starts to know too much. Is there any solution for this?
UPDATE (12 / Feb) . I have web.xml in the webapp folder and create a berth in the test case using this web.xml. Ideally, src / main / webapp does not fit in the classpath. It is used by the WAR plugin to package WAR. Now I tried an alternative when I placed my web.xml in the src / main / resource / console-webapp / WEB-INF / web.xml directory and changed the webXml attribute in the maven war plugin. This seems to solve my problem. However, in the output WAR, I have web.xml and another redundant web.xml (which was copied because it is in the classpath).
I tried "packageExcludes" and "webResources / excludes" and got the war plugin to omit the second web.xml, but still the console-webapp directory is copied (although it is empty). Is there a way to tell the maven war plugin to completely ignore the directory (i.e. What is the ant pattern for this?)
source share