I am getting the following error:
Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
I have got web.xml
in right place which is projectname\src\main\webapp\WEB-INF\web.xml
What could be causing this?
Now, once we execute the mvn install command, the WAR file will be generated inside the target folder. Using the mvn:war:exploded command, we can generate the exploded WAR as a directory inside the target directory.
Specifies where to find the web. xml file in the current Maven project, relative to the location of pom. xml . The default is src/main/webapp/WEB-INF/web.
The WAR Plugin is responsible for collecting all artifact dependencies, classes and resources of the web application and packaging them into a web application archive.
It would be helpful if you can provide a code snippet of your maven-war-plugin. Looks like the web.xml
is at right place, still you can try and give the location explicitly
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <configuration> <webXml>src\main\webapp\WEB-INF\web.xml</webXml> </configuration> </plugin>
<plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin>
This solution works for me (I was using 2.2 before). Also, I am using Java Based Configuration for Servlet 3.0 and no need to have web.xml file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With