Question

I am trying to select all jars from the current directory. I am getting confused between:

  • **/*.jar
  • *.jar

I assumed *.jar will work the same as **/*.jar. However the following examples are working differently:

<path id="master-classpath-common-lib" >
    <fileset dir=".">
        <include name="**/*.jar"/>
    </fileset>
</path>

<path id="master-classpath-common-lib" >
    <fileset dir=".">
        <include name="*.jar"/>
    </fileset>
</path>

For this case *.jar is not working at all.

Can anyone please give some hint on this.

Was it helpful?

Solution

*.jar means all the .jar files in only within the base directory, the directory specified in <fileset dir="${master.classpath}/lib">. This will not include the files in the subdirectories.

In **/*.jar, ** (used as the directory name) is a special feature, that means all the (nested) subdirectories.

Check out an example with explanation here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top