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 475817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:25:36+00:00 2026-05-13T00:25:36+00:00

I’ve inherited an Ant build system that contains many resource set definitions like this:

  • 0

I’ve inherited an Ant build system that contains many resource
set definitions like this:

<files id="app1.lib.jars">
  <include name="${java}/jre/lib/jsse.jar"/>
  <include name="${work.lib}/jtidy.jar"/>
  ...
</files>

<files id="app2.lib.jars">
  <include name="${work.lib}/itext.jar"/>
  <include name="${work.lib}/commons-httpclient.jar"/>
  ...
</files>

<files id="app3.lib.jars">
  <include name="${work.lib}/jdom.jar"/>
  <include name="${ant.lib}/ant.jar"/>
  ...
</files>

There are perhaps a dozen of these, and each can contain anywhere from
5 to 50 files. The problem is that I’m reworking this system to use
Ivy for dependency management, and in the process some of the
references now point to non-existent files. Unfortunately, Ant does
not provide any help finding these bad pointers. When these resource
collections are used to define a classpath any <include...> tags
pointing to missing files are silently ignored.

I thought I could force an error by using the collections as the
source of a <copy...>, but even with failonerror="true" it just
ignored the bad references.

The command-line -v (verbose) and -d (debug) option didn’t help
either. The output acknowledged that some were missing but didn’t
actually show them

 [echo] app1.lib.jars
 [copy] C:\dev\src\tomcat6\work\java\jre\lib\jsse.jar omitted as C:\dev\src\tomcat6\work\verify\jsse.jar is up to date.
 [copy] C:\dev\src\tomcat6\work\lib\axis-ant.jar omitted as C:\dev\src\tomcat6\work\verify\axis-ant.jar is up to date.
 ...
 [copy] No sources found.
 [echo] app2.lib.jars
 ...

For a one-time solution I extracted all the filenames from the
resource sets in the Ant file and compared that to a directory listing
of the result of copying all the files (in Ant) into a temporary
directory, after appropriate sorting.

Question: Is there a way to get Ant to tell me when a resource points
to a missing file, preferably at the time the resource is defined?

  • 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-05-13T00:25:36+00:00Added an answer on May 13, 2026 at 12:25 am

    Here’s an illustration of one method. Key points

    • Convert your files to filelists – these can contain names of files that don’t exist in the file system, unlike filesets and files, that ignore entries that don’t exist
    • Use a restrict to check for existence
    • Use a fail to error when something is missing

    You’ll need to add the “antlib:org.apache.tools.ant.types.resources.selectors” namespace to the project to use the resource selectors shown below. You’ll hit snags with Ant versions older than 1.7.0.

    <project name="so" default="checkfiles" basedir="."
    xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
    
    <filelist id="app1.lib.jars">
      <file name="${java}/jre/lib/jsse.jar"/>
      <file name="${work.lib}/jtidy.jar"/>
      ...
    </filelist>
    
    <restrict id="missing.app1.lib.jars">
      <filelist refid="app1.lib.jars"/>
      <rsel:not>
        <rsel:exists/>
      </rsel:not>
    </restrict>
    
    <property name="missing.files" refid="missing.app1.lib.jars" />
    <fail message="These files are missing: ${missing.files}">
      <condition>
        <length string="${missing.files}" when="greater" length="0" />
      </condition>
    </fail>
    <pathconvert property="found.files" refid="app1.lib.jars" />
    <echo message="Found files ${found.files}" />
    

    Alternatively, you could use the ‘copy’ task, as you suggest, but with filelists instead of files.
    The copy should fail when it tries to process the first resource that doesn’t exist.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have some data like this: 1 2 3 4 5 9 2 6
I know there's a lot of other questions out there that deal with this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but

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.