Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ant fileset dir exclude certain directory

Tags:

There are many questions on this topic but none of the answers are solving my problem. Starting this thread again to get fresh input.

I tried two different approaches for excluding B-dir and all its contents under A-dir/subdir. But none work. FYI, a-dir is under dir.src 1)

  <copy todir="${dir.classes}" excludes="A-dir/**/B-dir/**">   <fileset dir="${dir.src}" >     <exclude name="**/*.java"/>   </fileset>   </copy> 

2)

  <copy todir="${dir.classes}">   <fileset dir="${dir.src}" >     <exclude name="**/*.java"/>     <exclude name="A-dir/**/B-dir/**"/>   </fileset>   </copy> 

I tried deleting all old jars and do a clean compile like someone suggested. But that doesn't help either.

like image 622
user1164061 Avatar asked Apr 13 '12 00:04

user1164061


People also ask

What does the default excludes parameter of the FileSet element do?

Description. Alters the default excludes for all subsequent processing in the build, and prints out the current default excludes if desired.

What is FileSet dir ant?

A FileSet is a group of files. These files can be found in a directory tree starting in a base directory and are matched by patterns taken from a number of PatternSets and Selectors. PatternSets can be specified as nested <patternset> elements.

What is Pathelement in ant?

A path element is one "thing." That think may be one file or a whole path. But it doesn't do wildcards like fileset does. This is explained fairly well in path like structures. reply. /build.xml:372: java.net.UnknownHostException: root +ant.

What is Ant build XML?

Ant uses an xml file for its configuration. The default file name is build. xml . Ant builds are based on three blocks: tasks, targets and extension points. A task is a unit of work which should be performed and constitutes of small atomic steps, for example compile source code or create Javadoc.


1 Answers

I think it should probably be:

<copy todir="${dir.classes}"> <fileset dir="${dir.src}" >   <exclude name="**/*.java"/>   <exclude name="**/A-dir/**/B-dir/**"/> </fileset> </copy> 

Note the **/A-dir/** instead of A-dir/**.

like image 89
Tim Pote Avatar answered Sep 21 '22 13:09

Tim Pote