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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:23:16+00:00 2026-05-27T20:23:16+00:00

How can I include a set of files in a fileset ant task when

  • 0

How can I include a set of files in a fileset ant task when they are externally supplied from say a java program or as an xml file?

Conventionally we use the include and exclude regex for these kind of customization,

<fileset ...>
<include name="**/*Test.java" />
<exclude name="**/*.txt" />

But I do not know anything about the files to be included, to impose a condition on them as in this case we already know that we should include java files that end with test and ignore txt files..

The files to be included and excluded will be provided from an external source like a java program or as an xml format.. How can I include them in the fileset in such a case?

  • 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-27T20:23:17+00:00Added an answer on May 27, 2026 at 8:23 pm

    Figured out a way to do this..Included a groovy task within the ant script to get this done.. Say I have an input.xml like this :

    <include>       
        <targetclass name="com.samples.ClassToBeIncluded1" />               
        <targetclass name="com.samples.ClassToBeIncluded2" />
        <targetclass name="com.samples.ClassToBeIncluded3" />               
        <targetclass name="com.samples.ClassToBeIncluded4" />
    </include>
    

    that gives details about the classes to be included..I parse the file using a simple groovy parser and configure a new property in the ant that specifies the set of classes to be included..

    The new property is :

    <property name="instrumentedclasses" value=""/>
    

    The groovy script that reads the external input and sets the property is :

    <groovy>
        def xmlParser = new XmlParser()
        def includeStr = ""
        def eachFile  = new File('input.xml')
        def includeRootNode = xmlParser.parse(eachFile)         
        includeRootNode.targetclass.each{ targetClassNode ->
            def className = targetClassNode.attribute("name")
            className = className.replace(".","/")
            includeStr = includeStr +className+".class "
    
        }
        properties["instrumentedclasses"] = includeStr
    
    </groovy>
    

    Now the newly set property is used by ant script below to include the necessary classes :

    <fileset dir="${classes.dir}" includes="${instrumentedclasses}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I compile a C source file that #include's header files from each
Using scons I can easily set my include paths: env.Append( CPPPATH=['foo'] ) This passes
I can set the PHP include path in the php.ini : include_path = /path/to/site/includes/
How can I set a Flatpage as the Homepage? My urls.py is (r'', include('django.contrib.flatpages.urls')),
On the mxmlc command line, I can include paths to RSL files. I can
so with $filestosign = (dir -recurse-include *.ps1) Set-AuthenticodeSignature $filestosign $signingcert i can sign all
How can include .asp file inside of html file and have it proccessed besides
I wonder how a can include an pre-compiled binary in an iPhone application. I
With Msbuild v3.5 I can include the /m switch to enable multiprocessor support .
I would like to know if I can include some Jquery inside another JQuery

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.