What happens if someone runs the Ant symlink task on Windows (NTFS)?

I am writing an ant build script. I need to create a symlink and I found a symlink task. According to the manual, it only works on Unix. What happens if someone runs my build script on a Windows platform? Will failure build? Or will this task be ignored on the Windows platform? Or will it work in the case of an NTFS file?

+4
source share
2 answers

I am running Win7 and I have tried. Since I installed Mingw, it used ln. It seemed to me that all this was copied. Since a typical Windows installation does not have ln, it will not work there.

Here what happens without 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> 

build.xml

 <project name="MyProject" default="dist" basedir="."> <target name="dist"> <symlink link="lol" resource="d3dwindower" /> </target> </project> 
+3
source

I created a condition property to determine if I'm running on unix:

 <condition property="isUnix"> <os family="unix"/> </condition> 

and then use the if attribute for my purpose, so it will only run on unix:

 <target name="makeSymLinkToJar" depends="jar" if="isUnix"> <symlink link="${distlink.jar}" resource="${dist.jar}"/> </target> 
+1
source

All Articles