Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8020273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:38:39+00:00 2026-06-04T21:38:39+00:00

I have the following war task in my build.xml and even though needxmlfile is

  • 0

I have the following war task in my build.xml and even though needxmlfile is set to false, Ant (version 1.8.2) complains when the web.xml file does not exist (“BUILD FAILED … Deployment descriptor: /home/…/web/WEB-INF/web.xml does not exist“)

What am I missing?

  <target name="war" depends="build">                                                                           
    <mkdir dir="${build.dir}"/>                                                                                 
    <war                                                                                                        
      needxmlfile="false"                                                                                       
      basedir="${webroot.dir}"                                                                                  
      warfile="${build.dir}/${project.distname}.war"                                                            
      webxml="${webinf.dir}/web.xml">                                                                           
      <exclude name="WEB-INF/${build.dir}/**"/>                                                                 
      <exclude name="WEB-INF/src/**"/>                                                                          
      <exclude name="WEB-INF/web.xml"/>                                                                         
     </war>                                                                                                     
  </target>  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:38:40+00:00Added an answer on June 4, 2026 at 9:38 pm

    @O’Connor: thanks for the hint for using a fileset to pull the web.xml. However I am not sure you are correct about the needxmlfile set to true (at least in my experimentation I witnessed the opposite of what you describe). In any case, in the end I realized that not even the fileset is necessary since the war Ant task apparently packages everything under the basedir (unless explicitly excluded) so I am now using the following war task that works whether a web.xml file is present or not:

    <target name="war" depends="build">                                                                      
       <mkdir dir="${build.dir}"/>                                                                            
       <war                                                                                                   
          needxmlfile="false"                                                                                  
          basedir="${webroot.dir}"                                                                             
          destfile="${build.dir}/${project.distname}.war">                                                      
          <exclude name="WEB-INF/${build.dir}/**"/>                                                            
          <exclude name="WEB-INF/src/**"/>                                                                     
        </war>                                                                                                
    </target>         
    

    Setting needxmlfile to “true” causes Ant to complain if no web.xml file can be found during “waring”.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following pom.xml <project> <properties> <buildNumber>dev</buildNumber> </properties> <build> <finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName> </build> </project> This works
I have following plist: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd>
I was trying to deploy a WAR file using the Cargo Ant task version
I have following Maven projects set up: PM-Core PM-Web (with a dependency to PM-Core)
I'm using sprint 3.1 profiles and have the following code in my web.xml <context-param>
I have following script which is aim to make a war file. def ant
We (will) have the following architecture: Base.war will be a self-contained spring-hibernate application All
I have following situation: I have a Maven war project in NetBeans 6.7 I
I have the following project layout: WAR Project A Upstream Projects Dependency B Dependency
We have following problem. Developers frequently need to make small changes to our web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.