我编写了 ant 构建脚本。我需要创建一个符号链接(symbolic link),我找到了 symlink任务。根据手册,它只适用于 Unix。如果有人在 Windows 平台上运行我的构建脚本会怎样?构建会失败吗?或者这个任务在windows平台上会被忽略?或者在 NTFS 驱动器的情况下,它甚至可以工作?
最佳答案
我运行的是 Win7,我试过了。因为我已经安装了 Mingw,所以它使用了 ln。 ln似乎只是复制一切。由于正常的 Windows 安装没有 ln,因此会在那里失败。
如果没有 ln,会发生以下情况:
C:\Users\Janus\Desktop>.\apache-ant-1.8.2\bin\ant
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: C:\Users\Janus\Desktop\build.xml
dist:
BUILD FAILED
C:\Users\Janus\Desktop\build.xml:3: Could not launch ln: java.io.IOException: Cannot run program "ln": CreateProcess error=2, The system can
not find the file specified
Total time: 1 second
C:\Users\Janus\Desktop>
构建.xml:
<project name="MyProject" default="dist" basedir=".">
<target name="dist">
<symlink link="lol" resource="d3dwindower" />
</target>
</project>
关于windows - 如果有人在 Windows (NTFS) 上运行 Ant 符号链接(symbolic link)任务会怎样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6962089/