[groovy-user] AntBuilder Problem:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[groovy-user] AntBuilder Problem:

龚银
 I try to change ant's basedir property in AntBuilder,so I have some script like this:antTest.groovy
import org.apache.tools.ant.*;
Project project = new Project()
project.setBaseDir("d:/build")
AntBuilder ant = new AntBuilder(project)
ant.echo(ant.project.properties["basedir"])
ant.echo("finished")
but have some error:
E:\DOCUME~1\groovy\test>groovy antTest
Caught: groovy.lang.MissingMethodException: No signature of method org.apache.tools.ant.Project.setBaseDir() is applicable for argument types: (java.lang.String) values: {"d:/build"}

Is anybody else seeing this?
Reply | Threaded
Open this post in threaded view
|

RE: [groovy-user] AntBuilder Problem:

Antti Karanta


>  I try to change ant's basedir property in AntBuilder,so I
> have some script like this:antTest.groovy
> import org.apache.tools.ant.*;
> Project project = new Project()
> project.setBaseDir("d:/build")
> AntBuilder ant = new AntBuilder(project)
> ant.echo(ant.project.properties["basedir"])
> ant.echo("finished")
> but have some error:
> E:\DOCUME~1\groovy\test>groovy antTest
> Caught: groovy.lang.MissingMethodException: No signature of
> method org.apache.tools.ant.Project.setBaseDir() is
> applicable for argument types: (java.lang.String) values: {"d:/build"}
>
> Is anybody else seeing this?

  I have successfully changed the ant basedir like this:

def ant = new AntBuilder()
ant.antProject.basedir = "d:/build"

  I think the flaw in your code is that the method is called setBasedir,
not setBaseDir. This is a little inconsistent, as the corresponding
getter is called getBaseDir(). See javadocs for class
org.apache.tools.ant.Project.



       -Antti-



Reply | Threaded
Open this post in threaded view
|

Re: [groovy-user] AntBuilder Problem:

Russel Winder
In reply to this post by 龚银
On Thu, 2005-11-24 at 11:38 +0800, 龚银 wrote:

>  I try to change ant's basedir property in AntBuilder,so I have some script like this:antTest.groovy
> import org.apache.tools.ant.*;
> Project project = new Project()
> project.setBaseDir("d:/build")
> AntBuilder ant = new AntBuilder(project)
> ant.echo(ant.project.properties["basedir"])
> ant.echo("finished")
> but have some error:
> E:\DOCUME~1\groovy\test>groovy antTest
> Caught: groovy.lang.MissingMethodException: No signature of method org.apache.tools.ant.Project.setBaseDir() is applicable for argument types: (java.lang.String) values: {"d:/build"}
>
> Is anybody else seeing this?
Yes indeed.  I think this will turn out to be a bug.  I believe this
because changing the String to a File makes the problem go away, i.e.:

import org.apache.tools.ant.*;
Project project = new Project ( )
project.setBaseDir(new File ("d:/build"))
AntBuilder ant = new AntBuilder(project)
ant.echo(ant.project.properties["basedir"])
ant.echo("finished")

gives me the error:

Caught: Basedir /home/users/russel/Progs/Groovy/Gongvin_Ant/d:/build
does not exist
        at trial.run(trial.groovy:5)
        at trial.main(trial.groovy)

which isn't exactly surprising as I am using Debian GNU/Linux.  I
believe that this should have been the result of your original as well
on my system but I too got the MissingMethodException which is clearly
wrong given the API of org.apache.tools.ant.Project.

I think this one should be entered as a JIRA issue.

(The core team are at a meeting in Paris just now so it will likely be a
few days before the issue can be "attacked".)

--
Russel.
====================================================
Dr Russel Winder                +44 20 7585 2200
41 Buckmaster Road              +44 7770 465 077
London SW11 1EN, UK             [hidden email]

signature.asc (196 bytes) Download Attachment