Add web.xml in war by using Gradle

The web.xml file is not needed anymore to define deployment properties. It becomes optional with the opportunity to create the definitions inside the classes using the annotations introduced in Java EE 6. If you want to have it anyways in your web application and build your application with Gradle you can customize the build.gradle file. Add the following snippet to it:

war {
    // copies a file to WEB-INF/web.xml
    webXml = file('src/someWeb.xml') 
}

The part in the parentheses needs to point to your web.xml file. If you want to learn more about the customization of the war plugin check the Gradle Docs.

chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.