[Anthill] Change working directory for build
Varban
vvv at urbancode.com
Wed Dec 28 08:48:14 CST 2005
Hi Andy,
it seems strange that Anthill will not run the ant script from the root of the
downloaded source. Since Anthill is aware of where the source is downloaded,
it changes to that directory and then runs the ant script from there. It is
possible that because the ant process is not started in any console, any
child process will not see the current directory that ant was ran from but
insdead will point to the cmd.exe location that was used to execute the ant
process.
I am not sure how your A.java class locates the conf directory but I would try
and use the ClassLoader.getResourceAsStream and ClassLoader.getResource
methods to locate the properties files (you will need to add the directories
that hold them to the classpath). This way you will be completely independent
from the current working directory and the location of the code.
Regards,
Varban
On Wednesday 28 December 2005 09:08, Andy Levy wrote:
> I've finally tracked down where my build issues are coming from in anthill.
>
> Background: I have a JSP/Servlet web application stored in Subversion.
> After pulling the code from Subversion, my build script in build.xml
> does some checks, compiles Java console app A, executes A, then builds
> the web app B. My source tree is as follows:
>
> working_root\
> build.xml
> conf\
> A.java
> file1.properties
> src\
> hplg\
> file1.java
> web\
> js\
> calculator.jsp
>
> A.java compiles fine, then is executed. It is supposed to go through
> *.properties contained in the conf directory, build a properties
> object, then write it out to properties.serialized which is then read
> by the web app itself.
>
> A.java looks for *.properties inside the ./conf directory. So
> presumably it's expecting to be executed as java conf\A.class from the
> working_root directory.
>
> When I do an ant compile at the command line, in the working copy that
> anthill pulls down, everything runs fine.
>
> However, when it's run from within anthill, the current directory Java
> sees is c:\windows\system32 (I'm working on WinXP) and obviously it's
> not going to find my conf directory there.
>
> Is there a way to specify a directory for anthill to change to before
> executing anything in my build, so that everything sees the correct
> paths instead of c:\windows\system32? If not, can it be done via
> build.xml? I can't just hardcode a path in A.java.
> _______________________________________________
> Anthill mailing list
> Anthill at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill
More information about the Anthill
mailing list