简体   繁体   中英

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM