Ant mkdir 失败

发布于 2024-12-07 09:26:11 字数 1995 浏览 0 评论 0原文

我是蚂蚁的新手。请突出显示我的 build.xml 中出现的问题。任何帮助表示赞赏。谢谢。

问题:我想要创建的文件夹保留在当前目录的上层创建。

  • ant 版本:1.8.0
  • 平台: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 $ 

i'm new to ant. Please highlight which goes wrong in my build.xml. Any help is appreciated. Thanks.

Problem: The folders i wanted to make kept created on the upper level of current directory.

  • ant version: 1.8.0
  • platform: LinuxMint 10.10
  • java version "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>

Execution + Output:

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 $ 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暖树树初阳… 2024-12-14 09:26:11

有两件事你可以尝试。

1) 解决你的亲戚'.'通过将路径分配给具有位置属性的属性。

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

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

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

这应该会让你继续下去:)

Two things you can try.

1) Resolve your relative '.' path by assigning it to a property with the location attribute.

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

2) Use the build in basedir property which points to the directory of the build.xml file itself.

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

This should get you going :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文