ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Justin Patrin" <>
Subject Problems with symlinks
Date Wed, 30 Apr 2008 02:53:04 GMT
I've been trying to add what should be trivial to an ant build file. I
want to create a symlink if it doesn't already exist.

My environment:
Apache Ant version 1.7.0 compiled on September 23 2007

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)

Mac OS X 10.5.2

Using the <symlink> task I can create a symlink easily, but if the
symlink already exists the build fails. I tried setting
failonerror="false" but the build still fails if the symlink already

I have also tried <delete>, which did nothing. I then tried <symlink
action="delete"/> but then the build fails saying that the link
doesn't exist. When I tested the the link did exist, an immediate ls
of the path output by ant showed the symlink existed and was created
by me.

I also tried searching online and found the following which was
purported to work:
    <target name="symlink.test">
      <condition property="symlink.notexist">
          <available file="${basedir}/link" property="symlink.exists" />

    <target name="symlink" depends="symlink.test" if="symlink.notexist">
      <symlink link="${basedir}/link" resource="${basedir}/resource"/>

However, this always shows that the symlink doesn't exist. I
additionally tried removing the <condition> and <not> and using
"unless" instead of "if" in the "symlink" target but this does the
same thing.

Does anyone know what might be going on here?

Please include me on replies as I am not subscribed to this list.

Justin Patrin

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message