You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Tracy Jones <tr...@stratalight.com> on 2007/02/09 20:17:44 UTC

Re: using symlink on filesets

I am trying to create sym links in 1 directory for each file in another
directory.  I got this example from a previous posting, but so far am
unable to make it work for me.

The code is below - the problem I am having is that the sym link is
being created in whatever directory I am in when I run the ant command
rather than the directory that I have specified in the destdir argument
(foo).

<project name="test" default="testfoo">

        <target name="testfoo">

                <fileset dir="bar" id="commonRefId">
                        <include name="*" />
                </fileset>
                <symlinkFileset fsRefid="commonRefId" destdir="foo" />
        </target>

        <macrodef name="symlinkFileset">
                <attribute name="fsRefid" />
                <attribute name="destdir" />
                <sequential>
                        <echo message="@{destdir}"/>
                        <apply executable="ln" dir="@{destdir}"
verbose="true" parallel="false">
                                <arg value="-s" />
                                <arg value="-f" />
                                <arg value="-v" />
                                <fileset refid="@{fsRefid}" />
                        </apply>
                </sequential>
        </macrodef>

</project>


Here's the output of the run

root@StrataLight:/home/sluser# ant -f test.xml -d
Apache Ant version 1.7.0 compiled on December 13 2006
Buildfile: test.xml
Adding reference: ant.PropertyHelper
Detected Java version: 1.3 in: /opt/vame1.4
Detected OS: Linux
Adding reference: ant.ComponentHelper
Setting ro project property: ant.file ->
/var/stratalight/home/sluser/test.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile /var/stratalight/home/sluser/test.xml with URI =
file:///var/stratalight/home/sluser/test.xml
Setting ro project property: ant.project.name -> test
Adding reference: test
Setting ro project property: ant.file.test ->
/var/stratalight/home/sluser/test.xml
Project base dir set to: /var/stratalight/home/sluser
 +Target:
 +Target: depends
[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apache/tools/ant/antlib.xml. It could not be found.
 +Datatype symlinkFileset org.apache.tools.ant.taskdefs.MacroInstance
 [macrodef] creating macro  symlinkFileset
Attempting to create object of type
org.apache.tools.ant.helper.DefaultExecutor
Adding reference: ant.executor
Build sequence for target(s) `depends' is [depends]
Complete build sequence is [depends, ]

depends:
Adding reference: commonRefId
     [echo] foo
    [apply] Current OS is Linux
fileset: Setup scanner in dir /var/stratalight/home/sluser/bar with
patternSet{ includes: [*] excludes: [] }
    [apply] Executing 'ln' with arguments:
    [apply] '-s'
    [apply] '-f'
    [apply] '-v'
    [apply] '/var/stratalight/home/sluser/bar/a'
    [apply]
    [apply] The ' characters around the executable and arguments are
    [apply] not part of the command.
Execute:Java13CommandLauncher: Executing 'ln' with arguments:
'-s'
'-f'
'-v'
'/var/stratalight/home/sluser/bar/a'

The ' characters around the executable and arguments are
not part of the command.
    [apply] create symbolic link `./a' to
`/var/stratalight/home/sluser/bar/a'
    [apply] Applied ln to 1 file and 0 directories.

BUILD SUCCESSFUL

Can anyone help??

Tracy



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org