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

  • Home
  • SEARCH
  • 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 895455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:33:40+00:00 2026-05-15T14:33:40+00:00

I have the following in my build.xml: <target name=compile.baz depends=init> <javac destdir=${build.dir}/classes debug=on> <compilerarg

  • 0

I have the following in my build.xml:

<target name="compile.baz" depends="init">
   <javac destdir="${build.dir}/classes" debug="on">
      <compilerarg value="-Xlint:deprecation"/>
      <src>
         <pathelement location="${src.dir}/com/foo/bar/baz/" />
         <pathelement location="${src.dir}/com/foo/bar/quux/" />
         <!-- Need to exclude ${src.dir}/com/foo/bar/quux/dontwant/ -->
      </src>
      <classpath refid="classpath.jars" />
   </javac>
   ...
</target>

This mostly does what I want, except that (as the comment says) I do not want the files in
${src.dir}/com/foo/bar/quux/dontwant/ to be compiled by this task (but I do want everything else under ${src.dir}/com/foo/bar/quux/ to be compiled in this task).

I’m a complete ant n00b, and the documentation hasn’t been much help to me. I see several places where it says there are various exclude/excludes elements/attributes, but every variation I can think of either has no effect or results in an error like “blah doesn’t support the ‘exclude’ attribute”.

  • 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-15T14:33:41+00:00Added an answer on May 15, 2026 at 2:33 pm

    A couple of people suggested using <exclude>. This didn’t work with the way my task was specified. trashgod’s answer linked to the sixth example on this page which gave me an idea of how to restructure my task specification.

    It looks like my problem was related to the way I was specifying the source files. Rather than using <pathelement> elements in a <src>, like this:

    <src>
       <pathelement location="${src.dir}/com/foo/bar/baz/" />
       <pathelement location="${src.dir}/com/foo/bar/quux/" />
    </src>
    

    I switched to using a single <src> with a path and then a set of <include> elements, like this:

    <src path="${src.dir}" />
    <include name="com/foo/bar/baz/**" />
    <include name="com/foo/bar/quux/**" />
    

    This appears to be functionally identical, but is compatible with the use of <exclude>:

    <exclude name="${src.dir}/com/foo/bar/quux/dontwant/**"/>
    

    (Actually, I’m surprised that what was there in the first place worked at all.)

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

Sidebar

Related Questions

I have the following build.xml file setup in phpUnderControl. <target name=phpunit> <exec executable=phpunit dir=${basedir}/httpdocs
I have the following tasks in ant: <target name=init-junit depends=init> <mkdir dir=${junit.reports.individual} /> <property
I have the following build.xml and build.properties files: build.xml <?xml version=1.0 encoding=UTF-8?> <project name=CoolProducts
I have the following defined in a file called build-dependencies.xml <?xml version=1.0 encoding=UTF-8?> <project
I have the following code: Tag.find_all_by_company_id(4).each.collect{|tag| tag.name }.join(,) (Essentially I'm trying to build a
I have the following declaration in my build.xml file, in my src folder I
I have the following ant task: <target name=test> <replace file=test.txt token=smth value=anything/> </target> test.txt
my build.XML is given below. <property name=src.dir value=src/> <property name=lib.dir value=lib/> <property name=build.dir value=build/>
I have the following build script, which I run with MSBuild: <?xml version=1.0 encoding=utf-8?>
I have the following Phing configuration file: <?xml version=1.0 encoding=UTF-8?> <project name=ru.fractalizer.phpsweetpdo default=make-phar-packages basedir=..>

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.