ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject import classes in <scriptdef javascript/>
Date Fri, 14 Nov 2003 08:21:12 GMT
I want to check if some attributes are set and throw a BuildException if
not.
So I have to import the BuildException class. With <script> you would do
that
with
    importClass(Package.org.apache.tools.ant.BuildException);
"Package" is needed, because "org" is not a standard namespace (java, javax)
for that method
(see script task manual).

But inside <scriptdef> that doesn´t work.


    <scriptdef name="dofail" language="javascript">
        <![CDATA[
            // this would work
            //throw new java.lang.Exception("an Exception");

            // causes: ReferenceError: "Package" is not defined.
            importClass(Package.org.apache.tools.ant.BuildException);
            throw new BuildException("an Exception");
        ]]>
    </scriptdef>



Jan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message