蚂蚁:文件集" DIR"有一个运行时扩大完整路径属性 [英] Ant: fileset "dir" attribute with a runtime expanded full path
问题描述
让我们说我有一个文件系统,看起来有点像这样:
Let's say I have a file-system that looks a little something like this:
- C:\\东西\\ build.xml文件
- C:\\东西\\ MyFolder文件\\ library1.jar
- C:\\东西\\ MyFolder文件\\ library2.jar
里面的build.xml,我想定义看起来像这样的路径:
Inside build.xml, I want to define a path that looks like this:
<path id="some.id">
<fileset dir="myfolder">
<include name="**/*.jar"/>
</fileset>
</path>
通常工作正常。不过,我打电话给我自己的自定义Ant任务将继承任何引用(包括路径some.id)和自定义的Ant任务将调用,生活在不同BASEDIR一个build.xml。因此,目录属性的文件集不再有效。
Normally that works fine. However, I am calling my own custom Ant Task that will inherit any references (including the path "some.id") and that custom Ant Task will call a build.xml that lives in a different basedir. Therefore, the "dir" attribute in the fileset is no longer valid.
有没有办法定义一个目录,使得它仍然有效无论身在何处第二的build.xml生活?
Is there a way to define a "dir" such that it remains valid no matter where the second build.xml lives?
基本上我想要做这样的事情:
I essentially want to do something like this:
<fileset dir="${expand.current.directory}/myfolder">
所以,当我打电话第二的build.xml会明白,目录属性的位置:
So when I call the second build.xml it will understand that the "dir" attribute is the location of:
<fileset dir="c:\stuff\myfolder">
编辑:此外,我想一个解决方案,可以让我的东西项目从一台计算机复制到另一台,而无需更改构建。例如,如果东西项目是在C:盘,我在复制该项目到D:驱动器另一台机器上,我要构建继续没有我不必去到构建和改变信合作C到字母D。
Furthermore, I want a solution that allows me to copy the "stuff" project from one machine to another without requiring a change to the build. For example, if the "stuff" project is on the C: drive and I copy the project over to a D: drive on another machine, I want the build to continue to work without me having to go into the build and change the letter C to the letter D.
推荐答案
我觉得你的 $ {user.dir来}
属性之后是 - 这是当前工作。目录
I think you're after the ${user.dir}
property - which is the current working directory.
所有的Java System.properties 可作为ant属性。
All java System.properties are available as ant properties.
这篇关于蚂蚁:文件集&QUOT; DIR&QUOT;有一个运行时扩大完整路径属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!