When I set up a simple test using antserver and subant, I find that although when calling 'ant' the build works as expected, but when I call the same build thru antserver, it appears the basedir allways has the same value as the location from where the antserver is launched. I've included the simple build.xml that work as expected with subant. If you copy the code you'll and run ant, you get expected results, and launch the antserver, followed by the antclient.xml and you'll see the basedir is always relative to the location where antserver is launched from
When I try and run the antserver and antclient scripts against our existing build I cannot get it to work. I was hoping that understaning the ins/outs of this with the code snippets below would help me out. Although I can pass the ws.rootdir value in the antclient script in this example, I cannot in our existing build... uggg... But if anyone else has run into this and discovered relevant info I'd appreciate hearing you thoughts. THanks Much!
Results when running ant

Buildfile: build.xml
[echo] ws.rootdir : C:\workspaces\armstrong-automation\remote

all:
[echo] project : remote
[echo] ws.rootdir : C:\workspaces\armstrong-automation\remote
[echo] rootdir : C:\workspaces

all:
[echo] project : fubar
[echo] basedir : C:\workspaces\armstrong-automation\remote\fubar
[echo] ws.rootdir : C:\workspaces\armstrong-automation\remote
[echo] rootdir : C:\workspaces\armstrong-automation

Results when running antserver and antclient
ant -f antserver.xml &
ant -f antclient.xml

all:
[echo] project : remote
[echo] ws.rootdir : C:\workspaces\armstrong-automation\remote
[echo] rootdir : C:\workspaces

all:
[echo] project : fubar
[echo] basedir : c:\workspaces\armstrong-automation\remote\.
[echo] ws.rootdir : C:\workspaces\armstrong-automation\remote
[echo] rootdir : C:\workspaces


Note the value differences of ws.rootdir and basedir from the ant and antclient runs



build.xml
<?xml version="1.0" ?>
<project name="remote" basedir="." default="all">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

<property name="ws.rootdir" location="."/>
<echo>ws.rootdir : ${ws.rootdir}</echo>

<import file="${ws.rootdir}/common.xml"/>

<target name="all">
<echo>project : ${ant.project.name}</echo>
<echo>ws.rootdir : ${ws.rootdir}</echo>
<echo>rootdir : ${rootdir}</echo>

<subant target="">
<fileset dir="." includes="*/build.xml"/>
</subant>
</target>

</project>

common.xml
<?xml version="1.0" ?>
<project>
<property name="rootdir" location="../.."/>
</project>

fubar/build.xml
<?xml version="1.0" ?>
<project name="fubar" basedir="." default="all">
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

<property name="ws.rootdir" location=".."/>

<import file="${ws.rootdir}/common.xml"/>

<target name="all">
<echo>project : ${ant.project.name}</echo>
<echo>basedir : ${basedir}</echo>
<echo>ws.rootdir : ${ws.rootdir}</echo>
<echo>rootdir : ${rootdir}</echo>
</target>

</project>

antserver.xml
<?xml version="1.0" ?>
<project name="antserver">

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Import 3rd Party Tasks (SourceForge Ant-contrib)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

<antserver port="17000"/>

<target name="all">
<echo>${ant.project.name}</echo>
<ant output="${ant.project.name}.out"/>
</target>


<target name="fubar">
<echo>FUBAR</echo>
</target>

</project>

antclient.xml
<?xml version="1.0" ?>
<project name="antclient">

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Import 3rd Party Tasks (SourceForge Ant-contrib)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<taskdef resource="net/sf/antcontrib/antcontrib.properties"/>

<property name="topdir" location="."/>
<echo>${ant.project.name}: ${topdir}</echo>

<parallel>
<echo>Start build on localhost</echo>
<remoteant machine="localhost" port="17000">
<runant dir="." target="all" antfile="build.xml">
<property name="ws.rootdir" value="${topdir}"/>
</runant>

<!--
<runant dir="." target="all" antfile="build.xml"/>
-->
</remoteant>
</parallel>

</project>








Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business.