Reputation: 251
So I'm upgrading a really, really old project to Maven and its been an absolute nightmare. I'm planning on upgrading to Spring Boot and likely Spring MVC next, so I'm hesitant to start blowing up the directory structure until I get to that step.
My web.xml
file is located at /workspace/project_name/web/WEB-INF/web.xml, and I'd rather not start moving directories around to conform to Maven's standard directory layout.
In my POM I have
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<webXml>/web/WEB-INF/web.xml</webXml>
<failOnMissingWebXml>true</failOnMissingWebXml>
</configuration>
</plugin>
Originally M2Eclipse was complaining with errors related to not finding my POM, however those stopped when I added the path in <webXml>
.
When I right click on my POM to run as a Maven build, the base directory is set to ${workspace_loc:/project_name}
, with project_name being my actual project name. I've even tried hardcoding the file system directory, but no matter what it keeps looking in my C Drive:
The specified web.xml file 'C:\web\WEB-INF\web.xml' does not exist
Any idea what I'm doing wrong here? Is there a configuration with M2Eclipse that I missed somewhere?
Upvotes: 2
Views: 1620
Reputation: 2425
Try it with out a slash at the beginning. Maven will calculate the path from project root.
<webXml>web/WEB-INF/web.xml</webXml>
With a slash at the beginning, Maven considers it as an absolute path.
Upvotes: 2
Reputation: 356
The WEB-INF folder must be on webapp folder under {projectName}/src/main/webapp So, your complete path to web.xml would be
{projectName}/src/main/webapp/WEB-INF/web.xml
Hope it helps
Upvotes: 1