Ant mkdir 失败
我是蚂蚁的新手。请突出显示我的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两件事你可以尝试。
1) 解决你的亲戚'.'通过将路径分配给具有位置属性的属性。
2) 使用 build in basedir 属性,该属性指向 build.xml 文件本身的目录。
这应该会让你继续下去:)
Two things you can try.
1) Resolve your relative '.' path by assigning it to a property with the location attribute.
2) Use the build in basedir property which points to the directory of the build.xml file itself.
This should get you going :)