ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nico Seessle" <n...@seessle.de>
Subject Re: "undefined is not a function" error running <script>
Date Mon, 02 Oct 2000 08:58:51 GMT
----- Original Message -----
From: "Diane Holt" <holtdl@yahoo.com>
To: <ant-dev@jakarta.apache.org>
Sent: Monday, October 02, 2000 10:30 AM
Subject: "undefined is not a function" error running <script>


> I get an error at the <script> task when I run this target (it all works
> as expected up until it gets to there):
>
>   <target name="genNewBuildnum" depends="checkForOld"
> if="haveOldBuildnum">
>     <rename src="buildnum.properties" dest="oldBuildnum.properties"/>
>     <replace token="buildnum" value="oldBuildnum"
>               file="oldBuildnum.properties"/>
>     <antcall target="buildnum"/>
>     <property file="buildnum.properties"/>
>     <property file="oldBuildnum.properties"/>
>     <script language="javascript"> <![CDATA[
>       var newnum = parseInt(nightly.getProperty('buildnum'));
>       var oldnum = parseInt(nightly.getProperty('oldBuildnum'));
>       if ( newnum == oldnum ) nightly.setProperty('nochgs', true);
>      ]]>
>     </script>
>     <antcall target="notifyNochgs"/>
>   </target>
>
Are you sure 'nightly' refers to a project (i.e. your buildfile states
<project name="nightly" ..) ?

Give the following a try (works for me)

<?xml version="1.0"?>
<project name="nightly" default="default" basedir=".">

   <target name="default">
     <property name="buildnum" value="100"/>
     <property id="foo" name="oldBuildnum" value="100"/>

    <script language="javascript"> <![CDATA[
      var newnum = parseInt(nightly.getProperty('buildnum'));
      var oldnum = parseInt(nightly.getProperty('oldBuildnum'));
      if ( newnum == oldnum ) nightly.setProperty('nochgs', true);
     ]]>
    </script>

     <echo message="${buildnum} / ${oldBuildnum} / ${nochgs}"/>
   </target>


</project>

Does it work for you? It gives me the same error if I replace "nighlty" in
the first line of the script with "foo" which for sure has no method
"getProperty".




Mime
View raw message