You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Manoj Sadangi <ms...@manh.com> on 2003/05/14 17:30:14 UTC

How do I call another ant build file and pass parameter to it fro m a script task

when I try to pass the parameter this way
this is complaining that addProperty is not a function.
I am using ant1.5.1.     
this script i am calling from main build.xml
<script language="javascript"> <![CDATA[
        importClass(java.util.StringTokenizer);      
        stoken = new StringTokenizer(basedata.getProperty("mylist"),',');
        i = stoken.countTokens();
        for (k=0;k<i;k++)
        {
             sbean = stoken.nextToken();
             beanname = sbean.substring(sbean.lastIndexOf(","));
       	 jarIt = basedata.createTask('ant');
             jarIt.setAntfile("jarIt.xml");
             prop = jarIt.createProperty();
             prop.addProperty("sbean",sbean);
             jarIt.setInheritAll(true);
             jarIt.execute();
        }


    ]]> </script>

my jarIt xml looks like this.
<?xml version="1.0"?>
<project name="jarit" default="all" basedir=".">
  <property name="jarDir" value=project.getProperty("jarDir")/>
  <property name="earDir" value=project.getProperty("earDir")/>
  <delete dir="${jarDir}"/>       
  <copy todir="${jarDir}">
		<fileset dir="${sbean}" includes="*.class" /> 
  </copy>
  <copy todir="${jarDir}/META-INF">
	<fileset dir="${sbean}" includes="*.xml" /> 
  </copy>
<jar jarfile="${earDir}/${beanname}" basedir="${jarDir}" />
</project>

thanks, 
manoj 

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

Re: How do I call another ant build file and pass parameter to it fro m a script task

Posted by Stefan Bodewig <bo...@apache.org>.
On Wed, 14 May 2003, Manoj Sadangi <ms...@manh.com> wrote:

> this is complaining that addProperty is not a function.

There is no method addProperty in the Property class that would take
two arguments, in fact ther is no method of that name at all.

Maybe what you really mean is

    prop.setName("sbean");
    prop.setValue(sbean);

instead of 

>              prop.addProperty("sbean",sbean);

???

Stefan