简体   繁体   English

Apache Ant - 包含fileset中的父目录

[英]Apache Ant - include parent directory in fileset

Is it possible to include a file from a parent directory, seen from the defined dir? 是否可以从定义的目录中看到父目录中的文件?

If I define a fileset with a given dir, lets say /home/user/workspace/src , is ti possible to include a file eg /home/user/anotherworkspace/src/MyJavaClass.java ? 如果我用给定的dir定义一个文件集,让我们说/home/user/workspace/src ,是否可以包含一个文件,例如/home/user/anotherworkspace/src/MyJavaClass.java

Here the complete example, where the first include esist in the workspace: 这是完整的示例,其中第一个包括工作区中的esist:

<fileset id="myfileset" dir="/home/user/workspace/src">
    <include name="util/MyUtilClass.java"/>
    <include name="/home/user/anotherworkspace/src/MyJavaClass.java"/>
</fileset>

How to handle the second include? 如何处理第二个包括?

Unfortunately you can't do that with one fileset, but you can create two sets and then merge them using union resource collection. 遗憾的是,您无法使用一个文件集执行此操作,但您可以创建两个集合,然后使用union资源集合将它们合并。

<fileset id="myfileset1" dir="/home/user/workspace/src">
    <include name="util/MyUtilClass.java"/>
</fileset>

<fileset id="myfileset2" dir="/home/user/anotherworkspace/src">
    <include name="MyJavaClass.java"/>
</fileset>

<union id="myfileset">
    <resources refid="myfileset1" />
    <resources refid="myfileset2" />
</union>

After that you may use myfileset as usual. 之后你可以像往常一样使用myfileset

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM