This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Of paths, patternsets, and filesets

Posts: 67637
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to simplify my ant build files. I have multiple projects, many of which are similar and have similar dependencies.

For example, I have sets of jar files that need to be operated upon within each project build file. These jars need to become part of the classpath during the compile phase, and need to be copied to WEB-INF/lib during the deploy phase.

Here's what I'd like to achieve:

1) Factor as much as possible out of the individual project build files into a common imported file used across multiple projects.
2) Use a set of jar files from disparate locations as part of the classpath.
3) Copy that set of jar files to a single location (WEB-INF/lib).
4) Specify the set of files once, and use referencing elsewhere.

I'm using Ant 1.6.2 so macros can be part of the solution if need be.

One wrinkle is that the location and the name of the jar files needs to be parameterized via a property that is specific to each project (as each project may have a dependency on different version of the library).

Let's say for example that there are two libraries: abc and xyz. The file structure would be:

Where abc.version and xyz.version are per-project properties identifying the dependent versions.

I tried setting up path elements as follows (there are properties that factor out hard-coded settings, but they're not relevant here so I removed them in favor of hard-coded vlaues for the purpose of the discussion):

and that worked fine for the classpath of the javac task:

but failed when I tried to use it in a copy task. The copy task needs a fileset, and I found no way to use the defined path to create a fileset, and no way to assign an id to a fileset so it could be reference from multiple locations:

So, I figured I'm doing it all wrong.

Given my objectives, is there a way to construct paths, filesets and patternsets that meet them?

[ September 23, 2004: Message edited by: Bear Bibeault ]
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could create common patternsets as you can assign ids to patternsets

Just one way that comes to mind.

LOOK! OVER THERE! (yoink) your tiny ad is now my tiny ad.
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic