Dierk Koenig | 1 Feb 22:11 2006

[groovy-dev] Graven

Hiall,

I just played with Groovy RootLoader that gives you
the ability to add URL to your current classloader.
I asked myself what jars to add and found that I
have all the interesting ones in user_home/.maven :-)

Now comes the idea: in Groovy we could have a simple
method call like

 requires 'jfugue', '> 0.9'

to refer to such downloaded jars and add them to the
cp at runtime and download them if needed. 
This is where maven comes into play to find out
all transitive dependencies.

With the help of the according maven classes this
would be quite easy to implement. In combination
with maven we would have an equivalent feature
to Ruby-Gem for almost free.

cheers
Mittie

P.S. consequence: maven.jar needs to be added to
the Groovy distro.
P.P.S. this only works where RootLoader is 
available.

(Continue reading)

Marc Palmer | 1 Feb 22:47 2006
Picon

Re: [groovy-dev] Graven


> With the help of the according maven classes this
> would be quite easy to implement. In combination
> with maven we would have an equivalent feature
> to Ruby-Gem for almost free.

I've never really be taken by Maven. From what I can see, Ivy looks  
nicer (just handles dependencies not the build environment).

$0.02

Dierk Koenig | 1 Feb 23:17 2006

RE: [groovy-dev] Graven

I'm open to any solution that works ;-)

Maven would allow some reuse for existing 
Java-Libs.

Note that this is not about Groovy build support
but Groovy runtime support. -> No need to write
extra OS-dependent starter files with cp settings.

cheers
Mittie

> -----Original Message-----
> From: Marc Palmer [mailto:marc@...]
> Sent: Mittwoch, 1. Februar 2006 22:47
> To: dev@...
> Subject: Re: [groovy-dev] Graven
> 
> 
> 
> > With the help of the according maven classes this
> > would be quite easy to implement. In combination
> > with maven we would have an equivalent feature
> > to Ruby-Gem for almost free.
> 
> I've never really be taken by Maven. From what I can see, Ivy looks  
> nicer (just handles dependencies not the build environment).
> 
> $0.02

(Continue reading)

Dierk Koenig | 1 Feb 23:26 2006

[groovy-dev] RootLoader for compilation

I start with a script that contains

----
def file = new File('lib/mylib.jar')
this.class.classLoader.rootLoader.addURL(file.toURL())

MyClass.method()
----

MyClass.groovy depends on classes from mylib.jar.

When I groovyc MyClass, the script works fine.
Without precompiling, I get

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
failed, ...
MyClass.groovy: n: unable to resolve class xxx

Would it be possible to use the RootLoader also
for not-pre-compilation of dependent .groovy files?

cheers
Mittie

Graeme Rocher | 2 Feb 08:18 2006
Picon

Re: [groovy-dev] Graven

Marc is right in this sense, if you're looking at adding another
dependency Ivy is much smaller and more targeted at what its supposed
to to ie resolve dependencies.

Ivy re-uses the Maven repository so you get to re-use the same
java-libs as you would with maven

Graeme

On 01/02/06, Dierk Koenig <dierk.koenig@...> wrote:
> I'm open to any solution that works ;-)
>
> Maven would allow some reuse for existing
> Java-Libs.
>
> Note that this is not about Groovy build support
> but Groovy runtime support. -> No need to write
> extra OS-dependent starter files with cp settings.
>
> cheers
> Mittie
>
>
> > -----Original Message-----
> > From: Marc Palmer [mailto:marc@...]
> > Sent: Mittwoch, 1. Februar 2006 22:47
> > To: dev@...
> > Subject: Re: [groovy-dev] Graven
> >
> >
(Continue reading)

Dierk Koenig | 2 Feb 09:23 2006

RE: [groovy-dev] Graven

cool. I really have to look into it.
I always feared it would be poisonous ;-)

cheers
Mittie

> -----Original Message-----
> From: graeme.rocher@...
[mailto:graeme.rocher@...]On Behalf
> Of Graeme Rocher
> Sent: Donnerstag, 2. Februar 2006 8:18
> To: dev@...
> Subject: Re: [groovy-dev] Graven
> 
> 
> Marc is right in this sense, if you're looking at adding another
> dependency Ivy is much smaller and more targeted at what its supposed
> to to ie resolve dependencies.
> 
> Ivy re-uses the Maven repository so you get to re-use the same
> java-libs as you would with maven
> 
> Graeme
> 
> On 01/02/06, Dierk Koenig <dierk.koenig@...> wrote:
> > I'm open to any solution that works ;-)
> >
> > Maven would allow some reuse for existing
> > Java-Libs.
> >
(Continue reading)

Dierk Koenig | 3 Feb 11:57 2006

RE: [groovy-dev] RootLoader for compilation

ok, it's working now. 

I have no idea what changed to make it run :-)

cheers
Mittie

> -----Original Message-----
> From: Dierk Koenig [mailto:dierk.koenig@...]
> Sent: Mittwoch, 1. Februar 2006 23:26
> To: dev@...
> Subject: [groovy-dev] RootLoader for compilation
> 
> 
> I start with a script that contains
> 
> ----
> def file = new File('lib/mylib.jar')
> this.class.classLoader.rootLoader.addURL(file.toURL())
> 
> MyClass.method()
> ----
> 
> MyClass.groovy depends on classes from mylib.jar.
> 
> When I groovyc MyClass, the script works fine.
> Without precompiling, I get
> 
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed, ...
(Continue reading)

Dierk Koenig | 3 Feb 12:19 2006

RE: [groovy-dev] RootLoader for compilation

oops, sorry. I fooled myself with adding the jars manually
to the cp for compiling and the forgot to set it back.

Was anyway able to solve the issue by using
GroovyScriptEngine.

cheers
Mittie

> -----Original Message-----
> From: Dierk Koenig [mailto:dierk.koenig@...]
> Sent: Freitag, 3. Februar 2006 11:58
> To: dev@...
> Subject: RE: [groovy-dev] RootLoader for compilation
> 
> 
> ok, it's working now. 
> 
> I have no idea what changed to make it run :-)
> 
> cheers
> Mittie
> 
> > -----Original Message-----
> > From: Dierk Koenig [mailto:dierk.koenig@...]
> > Sent: Mittwoch, 1. Februar 2006 23:26
> > To: dev@...
> > Subject: [groovy-dev] RootLoader for compilation
> > 
> > 
(Continue reading)

Graeme Rocher | 3 Feb 17:32 2006
Picon

[groovy-dev] Calling the root node of a builder from Java

Hi,

I'm doing some work at the moment where I get a Closure passed in as
an argument to a java method. I want to pass this Closure to a
MarkupBuilder instance to build the necessary markup from Java.

How do I do this? I've tried

MarkupBuilder mkp = new MarkupBuilder(out);
mkp.invokeMethod("doCall", new Object[]{ closure });

but this results in "doCall" becoming the root node of my markup

Cheers
Graeme

John Wilson | 3 Feb 18:08 2006
Picon

Re: [groovy-dev] Calling the root node of a builder from Java


On 3 Feb 2006, at 16:32, Graeme Rocher wrote:

> Hi,
>
> I'm doing some work at the moment where I get a Closure passed in as
> an argument to a java method. I want to pass this Closure to a
> MarkupBuilder instance to build the necessary markup from Java.
>
> How do I do this? I've tried
>
> MarkupBuilder mkp = new MarkupBuilder(out);
> mkp.invokeMethod("doCall", new Object[]{ closure });
>
> but this results in "doCall" becoming the root node of my markup

If you were to use StreamingMarkupBuilder you would do this

import groovy.xml.StreamingMarkupBuilder

def c = {root { leaf(attr:"hello")}}

def b = new StreamingMarkupBuilder()

def markup = b.bind(c)

System.out << markup

Which produces

(Continue reading)


Gmane