Failed to build war in maven project

A couple of problems: In is not suitable for my maven project in Eclipse Run as - Run on Server. 2) So I want to work directly on the tomcat server, wo, when I try to create a war, the following error appears .please help me, I have my web.xml only on the specified path

Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project SchoolMgmtApp: The specified web.xml file 'F:\WorkSpace\SchoolMgmtApp\src\main\webapp\WEB-INF\web.xml' does not exist - 
+6
source share
3 answers

I think the error is self-explanatory. You do not have web.xml in your project. Is this intended? Theoretically, you could have a WAR file without a web.xml , since Servlet 3.0 supports such deployments. In this case, you should configure the maven-war-plugin as follows:

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.2</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> 
+22
source

Your web.xml may not be in the standard location. Some Eclipse project creation wizards put web.xml in WebContent / WEB_INF. In this case, you can rebuild the project so that he likes maven, or you can tell maven where you can find your web.xml in pom.xml.

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webXml>WebContent\WEB-INF\web.xml</webXml> ... 
+5
source

I think you are looking for something like this:

 <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <warName>${applicationContextName}</warName> <packagingExcludes> AFolder, aFile.xml </packagingExcludes> </configuration> <executions> <execution> <id>default-war</id> <phase>package</phase> <goals> <goal>war</goal> </goals> </execution> </executions> </plugin> 
0
source

Source: https://habr.com/ru/post/908761/


All Articles