文件集目录未正确排除
学习 Ant - 我试图排除某个目录下的所有文件:
<fileset dir="${testclasses.dir}" id="test.files">
<exclude name="**/directory-to-exclude/*.class"/>
</fileset>
并确保我正确排除,我打印出该文件集下的所有类,如下所示:
<path id="updated.test.classes.path">
<fileset dir="${testclasses.dir}"/>
</path>
<pathconvert pathsep="${line.separator}| |-- "
property="echo.path.compile"
refid="updated.test.classes.path">
</pathconvert>
<echo message="Printing updated class path: ${echo.path.compile}"/>
但我仍然看到:
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$$anon$1.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$$typecreator1$1.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Complex$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Complex.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Deep$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Deep.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$LessDeep$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$LessDeep.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$StrToTime.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Struct$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Struct.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass.class
为什么会发生这种情况?
Learning Ant - I'm trying to exclude all files under a certain directory with:
<fileset dir="${testclasses.dir}" id="test.files">
<exclude name="**/directory-to-exclude/*.class"/>
</fileset>
and to make sure I excluded correctly, I'm printing out all the classes under that fileset like so:
<path id="updated.test.classes.path">
<fileset dir="${testclasses.dir}"/>
</path>
<pathconvert pathsep="${line.separator}| |-- "
property="echo.path.compile"
refid="updated.test.classes.path">
</pathconvert>
<echo message="Printing updated class path: ${echo.path.compile}"/>
Yet I still see:
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$anon$1.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$typecreator1$1.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Complex$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Complex.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Deep$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Deep.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$LessDeep$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$LessDeep.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$StrToTime.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Struct$.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass$Struct.class
[echo] | |-- /path/to/testfiles/directory-to-exclude/SomeTestClass.class
why is this happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有使用预定义的文件集,您需要:
注意
refid=
参数,该参数使用您通过排除定义的文件集。实际代码将仅包含所有文件。
正如您所观察到的,路径任务中的
You aren't using the fileset you pre-defined, you want:
Note the
refid=
parameter, which makes use of the fileset you defined with the exclusion.Your actual code
in the path task will simply include all files, as you observed.