Ant mkdir failed



我是新来的。请突出显示在我的build.xml中出错的地方。任何帮助都是感激的。谢谢。

问题:我想创建的文件夹一直创建在当前目录的上层。

  • ant版本:1.8.0
  • 平台:LinuxMint 10.10
  • java版本"1.6.0_20"
  • OpenJDK Runtime Environment (IcedTea6 1.9.9) (6b20-1.9.9-0ubuntu1~10.10.2)
  • OpenJDK Server VM (build 19.0-b09, mixed mode)

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)解决你的亲戚。通过将其分配给具有location属性的属性来创建路径。

<property name="my.path" location="."/>
<echo message="my.path = ${my.path}"/>

2)使用build in basedir属性指向build.xml文件本身的目录。

<echo message="basedir = ${basedir}"/>

这应该会让你开始:)

相关内容

  • 没有找到相关文章

最新更新