Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between a nested path and fileset?

Tags:

path

ant

fileset

I have been googling for the "Differences between fileset and path" article for some time, but have found nothing useful. For example, what is the difference between the following (say, there is a someDir directory, which contains .jar files and has no subdirectories):

<path id="somePathId">
    <pathelement path="someDir"/>
</path>

<path id="someId">
  <path refid="somePathId" />
</path>

and

<path id="someId">
  <fileset dir="someDir">
     <include name="*.*">
  </fileset>
</path>

?

like image 601
Dmitry Avatar asked Jul 01 '11 06:07

Dmitry


1 Answers

They are used in different situations.

fileset is used to specify a group of files. You can use selectors and patternsets to get only the files you want.

classpath is used to specify classpath references. classpath can be specified with a single jar (location="..."), a ; or : separated list of jars (path="...") or with nested resource collections (like fileset).

Also if you want to debug them, it is different:

<echo message="Build-path: ${toString:build-path}" />

vs

<property name="debug.classpath" refid="classpath"/>
<echo message="Classpath = ${debug.classpath}"/>

As for your scripts,

<path id="somePathId">
    <pathelement location="someDir"/>
</path>

I did not test it but according to the documentation path= expects a ; or : separated list of jars. This is not the same as your second example.

like image 55
Thresh Avatar answered Oct 04 '22 03:10

Thresh