Ant mkdir失败了

时间:2011-10-01 01:24:54

标签: ant mkdir

我是蚂蚁的新手。请突出显示我的build.xml中出错的地方。任何帮助表示赞赏。感谢。

问题:我想创建的文件夹在当前目录的上一级保持创建。

  • ant version:1.8.0
  • platform:LinuxMint 10.10
  • java版“1.6.0_20”
  • OpenJDK运行时环境(IcedTea6 1.9.9)(6b20-1.9.9-0ubuntu1~10.10.2)
  • OpenJDK Server VM(build 19.0-b09,混合模式)

的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 $ 

1 个答案:

答案 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}"/>

这应该让你去:)