[英]Can I include only annotated classes in the ant fileset to work with?
I want 2 ant tasks in the build file. 我想在构建文件中的2蚂蚁任务。 Both of the tasks are for testing.
两项任务均用于测试。 The only separation between the two is in the test-classes that the must run.
两者之间的唯一区别在于必须运行的测试类中。 I was thinking if I can annotate one set of these tests, and ant could include/exclude depending on annotations, maintenance would be much easier for me.
我当时在想,如果我可以注释其中一组测试,并且ant可以根据注释来包含/排除,维护对我来说将更加容易。 All the tests are in the same directory, I don't have authority to refactor the 2 sets into 2 separate directories.
所有测试都在同一目录中,我无权将2组重构为2个单独的目录。
For instance: 例如:
@alphaSet @alphaSet
Class A A级
@alphaSet @alphaSet
Class B B级
@betaSet @betaSet
Class C C级
@betaSet @betaSet
Class D D级
Is there a way to include only @alphaSet classes (or only @betaSet classes) in the fileset inside the test tasks of the build script? 有没有一种方法可以在构建脚本的测试任务内的文件集中仅包含@alphaSet类(或仅@betaSet类)?
Thanks in advance. 提前致谢。
Use fileset with selector(s) , fe : 将文件集与选择器( fe )一起使用:
<fileset dir="some/dir" includes="**/*.java" id="alphaSet">
<contains text="@alphaSet" casesensitive="yes"/>
</fileset>
<fileset dir="some/dir" includes="**/*.java" id="betaSet">
<contains text="@betaSet" casesensitive="yes"/>
</fileset>
<!-- control includes via echo -->
<echo>${toString:alphaSet}</echo>
<echo>${toString:betaSet}</echo>
if more criterias needed, use selectorcontainers and/or/not .. , fe : 如果需要更多标准,请使用选择器容器和/或/ ..,fe:
<fileset dir="some/dir" includes="**/*.java" id="alphaSet">
<and>
<contains text="@alphaSet" casesensitive="yes"/>
<not>
<!-- some other selectors ... -->
</not>
<and>
</fileset>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.