In your case, you're declaring *classes* so the first checkbox needs to be
unchecked.
And in anycase:
run /foo/bar/ClassB will execute the code as if it were a script. ie. it will
execute anything outside the class declaration, and not the main() method.
What you'd need to do so simulate this in the concsole with your classes as
they are is:
foo.bar.ClassB.main(null)
If you want to run it as a script with run /foo/bar/scriptB, scriptB would need
to contain something along those lines:
----
package foo.bar; // not checked in case of a script, but will avoid forcing you
to import stuff from the same package/directory
// the out variable is available and is a writer instance pushed to the console
in this case
out.println("hey, I'm executed as a script!");
out.println(new ClassA());
----
... and the "is script" flag should thus be set to truze for "scriptB".
hth,
-g
On Jul 20, 2010, at 21:09, [email protected] wrote:
> Yes I did have both enabled. Good question though.
>
> Rich Gange
> Systems Analyst II, ISD
> Manatee County Government
> (941) 748-4501 Ext. 3918
>
>
> From: Grégory Joseph <[email protected]>
> To: "Magnolia Dev-List" <[email protected]>
> Date: 07/20/2010 02:30 PM
> Subject: Re: [magnolia-dev] Groovy Scripts
> Sent by: <[email protected]>
>
>
>
>
>
> Hi Richard,
>
> Just to be sure: did you see "is a script" to false (i.e un-checked the box)
> and "enabled" to true (i.e checked the box). If the latter is unchecked, the
> groovy module will only load this script from the classpath and ignore
> whatever is in the repository (which, granted, is probably silly in your
> case, since it sounds like your scripts are *only* in the repository)
>
> If that's not it, then it sounds like a bug...
>
> HTH,
>
> -g
>
> On Jul 20, 2010, at 18:53, [email protected] wrote:
>
> > Hello-
> >
> > First of all I'm working in Magnolia 4.3.2 and I'm trying to write groovy
> > scripts. What I would like to do write a couple of classes where one class
> > embeds an object of the other.
> >
> > For example I have created a package called foo.bar and two classes ClassA
> > and ClassB like so:
> >
> > <Mail Attachment.gif>
> >
> >
> > ClassA looks like this:
> >
> > <Mail Attachment.gif>
> >
> >
> > ClassB looks like this:
> >
> > <Mail Attachment.gif>
> >
> >
> > When I try and run ClassB in the Groovy Console I get the following:
> >
> > <Mail Attachment.gif>
> >
> > Can someone shed some light here? What am I missing? Or can I not use
> > groovy scripts in this manner?
> >
> > Thanks
> >
> > Rich Gange
> > Systems Analyst II, ISD
> > Manatee County Government
> > (941) 748-4501 Ext. 3918
>
>
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------
>
>
>
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------