问题:我想创建的文件夹在当前目录的上一级保持创建。
的build.xml:
<property name="prj.root" value="." />
<property name="build.dir" value="${prj.root}/build"/>
<property name="build.docs" value="${build.dir}/docs"/>
<property name="build.models" value="${build.dir}/models"/>
<property name="build.projects" value="${build.dir}/projects"/>
<property name="dist.dir" value="${prj.root}/dist"/>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="init" depends="clean" description="initialization target">
<echo message=">> Build JAS ${jas.version} at ${prj.root}"/>
<echo message="build.dir = ${build.dir}" />
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.docs}" />
<mkdir dir="${build.models}" />
<mkdir dir="${build.projects}" />
<mkdir dir="${dist.dir}"/>
</target>
执行+输出:
yamhon@yamhon-g410 ~/projects/JAS $ ant init
Buildfile: /home/yamhon/projects/JAS/build.xml
clean:
[delete] Deleting directory /home/yamhon/projects/build
[delete] Deleting directory /home/yamhon/projects/dist
init:
[echo] >> Build JAS ${jas.version} at .
[echo] build.dir = ./build
[mkdir] Created dir: /home/yamhon/projects/build
[mkdir] Created dir: /home/yamhon/projects/build/docs
[mkdir] Created dir: /home/yamhon/projects/build/models
[mkdir] Created dir: /home/yamhon/projects/build/projects
[mkdir] Created dir: /home/yamhon/projects/dist
BUILD SUCCESSFUL
Total time: 0 seconds
yamhon@yamhon-g410 ~/projects/JAS $
答案 0 :(得分:0)
你可以尝试两件事。
1)解决你的亲戚'。'路径通过将其分配给具有location属性的属性。
<property name="my.path" location="."/>
<echo message="my.path = ${my.path}"/>
2)使用build in basedir属性,该属性指向build.xml文件本身的目录。
<echo message="basedir = ${basedir}"/>
这应该让你去:)