How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

Posted on

Introduction

This article will show how to solve a problem on building a war file using maven tool in Eclipse IDE. Actually, there is a dynamic web project exist in Eclipse IDE. The process for creating the dynamic web project exist in the article in this link. It is an article with the title of ‘How to Build a Dynamic Web Project using Maven in Eclipse’. Furthermore, before building the war file, the dynamic web project in the end is turning into a maven project.

Converting the dynamic project into a maven project is also exist in this link as a reference. The title of the article is ‘How to Convert a Dynamic Web Project into a Maven Project in Eclipse’. Soon after converting the project into a maven project, the next step is building the project itself. The result of the build process is a war file.  But apparently, the build process fail and the following is the error appear :

How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

Furthermore, the following is the detail of the error :

How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

Solution to solve the problem

Apparently, the solution to solve the above error is quite simple. The hint for solving the problem is already exist in the error message. That is webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode). Well, after checking the web.xml file in the WEB-INF folder, there is no where to be available. It is because upon creating the dynamic web project, the checkbox for generating web.xml is not selcted. So, the solution is just to create a web.xml file after the project has available. Below is an alternative step to create the file :

1. Right click at the project folder and execute the suitable menu. Execute Java EE Tools > Generate Deployment Descriptor Stub. It exist as in the following image :

How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

This is the previous appearance of the directory of the project before generating the web.xml file :

How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

And this is the appearance of the directory of the project after generating the web.xml file :

How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)
How to Solve Error Message Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode)

 

Finally, after adding the web.xml file in the WEB-INF folder, just reexecute the build process. If there is no other error appear, it will generate the war file in the target folder. The success for building the war file of dynamic web project using maven tool exist in this link. It is an article with the title of ‘How to Build a Dynamic Web Project using Maven in Eclipse’ for further reference.

Leave a Reply