sAm
sAm

Reputation: 321

Apache ant exclude a single file in fileset

I have very less experience with Ant and I want to add all jar files from a folder except a single jar. I tried following:

<fileset dir="..\abc\xyz"  includes="..\abc\xyz\*.jar" />
<fileset dir="..\abc\xyz"  exclude="..\abc\xyz\Fubar.jar" />

It still added Fubar.jar.

I also tried

<fileset dir="..\abc\xyz"  includes="..\abc\xyz\*.jar" exclude="..\abc\xyz\Fubar.jar" />

Still added Fubar.jar. I know this can be achieved by isolating Fubar.jar by adding remaining files like:

<fileset dir="..\abc\xyz"  include="..\abc\xyz\AAA.jar" />
<fileset dir="..\abc\xyz"  include="..\abc\xyz\BBB.jar" />
.
.
.
Except Fubar.jar

But this doesn't look good and if number of files increase, the list will also increase though I am trying to exclude just a single file.

Upvotes: 2

Views: 4268

Answers (1)

blitzqwe
blitzqwe

Reputation: 2040

You already specified the root in the dir attribute: Try:

<fileset dir="..\abc\xyz">
  <include name="*.jar" />
  <exclude name="Fubar.jar"  />
</fileset>

Upvotes: 4

Related Questions