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.

有帮助吗?

解决方案

*.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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top