• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Include files in target

 
Ranch Hand
Posts: 68
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although it should not be a problem, I want to exclude everything except *.java files from my Ant build targets. But when I test using ant -v I can see that every single file in the directory tree is being tested and all except *.java files are being skipped as Ant don't know how to handle them.

The problem is probably simple to solve but given my very short experience with Ant (less than two days) I haven't been able to figure it out myself, despite a massive amount of searching.

As you can see from the build.xml file, my project is split across three packages which depend on each other.

 
Saloon Keeper
Posts: 27707
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way it looks to me is that you think "fileset" is some sort of magic definition that the javac task is expected to intuitively pick up and use. Ant doesn't intuitively pick up anything and each element is expected to be self-contained. If you want Ant to use it, you have to explicitly tell Ant to use it.

fileset is a qualifier applicable to some (but not all Ant task types). To make it work, it has to be an embedded element of the task that's filtering files. Or, alternatively, it can be a named definition that's done external to the list of targets and then referenced by name by those tasks that wish to apply the filtering rules it defines.
 
Philip Grove
Ranch Hand
Posts: 68
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually what I think in relation to the <fileset> element is very limited as the information I have found by searching and reading documentation is conflicting. But I don't remembering trying it as an embedded element of the tasks so I will look into that when my code actually compiles again.

Thanks for the input
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think the javac task manual page is terribly conflicting; here's one of their examples:Note the lack of a fileset, because it's simply not necessary. Here's another option:Still no fileset, because it's not necessary.
 
Philip Grove
Ranch Hand
Posts: 68
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is necessary if you want to avoid getting other files looked at, but that is harmless. There is another reason that there is no fileset, it is not allowed in the javac task. Your second example almost gives away the solution, the parameters include and exclude.

But you are right that the manual page is pretty clear, how I missed it remains a mystery to me. That could have saved a lot of time for everybody.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The files are going to be looked at no matter what--*something* will decide whether or not it should be compiled.
 
Today's lesson is that you can't wear a jetpack AND a cape. I should have read this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic