You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Max Nalsky <ma...@mccme.ru> on 2000/11/14 17:47:31 UTC

current working dir in Ant task

Hello!

Has anyone any ideas on the following problem:

I was trying to invoke Ant task from the build.xml like this:

<target name="autobuild">
    <ant dir="subproject" target="test" />
</target>

The target "test" in subproject/build.xml invokes some program which use
current working directory as a base directory of all internal test
files. The problem is that program cannot find some of the files. After
investigation I faced a fact that the missing file is a DLL located inside
my project. This DLL is resolved via "java.library.path" property, which I
honestly substitute while invoking java inside "test" target. BUT! I
substitute it with RELATIVE path which is INCORRECT since current working
directory IS NOT "./subproject", it's ".". That's why I get
UnsatisfiedLinkError exception.

As far as I understand while inside JVM one cannot change working 
directory. That's why I thought that forking may help in this case - if we
can fork another VM for building subproject, we could set working dir for
it correctly and it would find DLL. But, Ant task does not support
forking. "Ok", - said I to myself, "this will hardly take more than
several hours to implement forking in Ant.java" and was confused with
a lot of code duplication in ...ant.taskdefs.Ant and ...ant.Main. It even
seems to me that if subproject is invoked with Ant task - it won't receive
a BuildStarted event since there's no such fireBuildStarted invocation in
Ant.java. That's why I decided to ask for your help - maybe I'm missing
something?

Ant gurus! What would you advice me to do if I still would like to make
Ant setting working dir correctly for subprojects?

Thanks in advance,
Max Nalsky