ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey N. Solofnenko" <>
Subject Re: NEWBIE: Dir-attribute/script problem
Date Tue, 20 Jun 2006 17:56:35 GMT
I got that problem too, but my solution maybe too low level. In Jython 
import folders are hard coded and read only, so I wrote my own launcher 
that understood -M option and a special Java property and put them into 
PySystemState.path list (for example, state.path.append(new 
PyString(path));). I needed extra path directories to be specified on 
command line. I [currently] have no idea whether it is possible to 
access the state from the script itself.

- Alexey.

Sol Kindle wrote:
> Hey now,
> This is my first Ant project (so please bear with me).  My goal here 
> is to have a single Ant file to build all of my sub-projects.
> I am having some trouble getting a third party Ant project (call it 
> "foo") to run as a subproject to my "top-level" build project.  The 
> Foo build runs just fine when Ant is run directly on it (in it's 
> sub-dir), but fails to run a jython script when called from my 
> "top-level" build file.  Here's the failure output...
> Buildfile: build.xml
> foo:
> bar:
>   [script] Traceback (innermost last):
>   [script]   File "<string>", line 9, in ?
>   [script] ImportError: no module named buildUtil
> It fails because the script in the "bar" target cannot find cannot 
> find the file.  But the file is located in 
> the same directory as the Foo build.xml file (see Directory Layout below)
> I had thought that "dir" attribute of the "ant" task would change the 
> current directory context for scripts as well as the build.txt file.   
> It seems to me as if the "dir" attribute of the "ant" task in my 
> top-level build file does not change the working dir for the jyhon 
> script.  Does this make sense?
> Any suggestions?  Thank you in advance.
> -Sol
> My build.xml target to build 3rd party project
> ===============================
> <target name="foo" description="builds the foo project">
>        <ant dir="./foo/buildscripts" target="bar"></ant>
> </target>  
> Directory Layout
> ===========
> ./build.xml                                 #my top-level build file
> ./foo/buildscripts/build.xml         #3rd party build file
> ./foo/buildscripts/     #jython script
> ./foo/buildscripts/lib/    #jython library
> 3rd Party Target (from ./foo/buildscripts/build.xml)
> ===========
> <target name="bar" description="Does something">
>        <script language="jython"><![CDATA[
> import sys
> # make the python standard library avialable
> sys.path.append("lib/")
> sys.path.append(".")
> # import re
> import os
> from buildUtil import *
> 3rdPartyFunction()
> ]]></script>
> </target>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message