Search code examples
windowsantsymlinkntfs

What happen if someone run Ant symlink task on Windows (NTFS)?


I write ant build script. I need to create a symlink and I found symlink task. According to manual, it works only on Unix. What happens if someone run my build script on windows platform? Will build fail? Or this task will be ignored on windows platform? Or in case of NTFS drive, it will even work?


Solution

  • I'm running Win7 and I tried it. Since I have Mingw installed it used ln. Ln seemed just to copy everything. Since a normal Windows installation does not have ln, it would fail there.

    Here's 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>