You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Alex Soto <as...@gmail.com> on 2014/10/24 08:52:28 UTC

@Grab like syntax and TomEE

Hi, today I was thinking a way to implement some @Grab like annotation (
http://groovy.codehaus.org/Grape) for Java EE. This could be useful for
example to add Hibernate as JavaEE provider or any other library. Because
TomEE supports jars.txt approach, I was thinking to use this approach.
Something like scan all classpath, finds the "@Grab" annotation crfeate the
jars.txt and TomEE well do the same. My question is that it would be
awesome if we could use the scanning process of TomEE (to not rescan the
whole classpath more thanone time).

Do you think it is possible?

-- 
+----------------------------------------------------------+
  Alex Soto Bueno
  www.lordofthejars.com
+----------------------------------------------------------+

Re: @Grab like syntax and TomEE

Posted by Romain Manni-Bucau <rm...@tomitribe.com>.
it doesn't work, you need double scanning to avoid issue: 1 add jars,
2) scan. otherwise you  'll get classnotfound etc
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-10-24 9:17 GMT+02:00 Alex Soto <as...@gmail.com>:
> Yes I am not sure exactly how to do it, for me the best way would be that
> meanwhile openejb is scanning the classes when they found a @Grab then it
> adds an entry to jars.txt, then jars.txt is copiend into WEB-INF/lib. The
> problem is that this process should be done before TomEE reads the jars.txt
> file.
>
> 2014-10-24 9:13 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:
>
>> Main issue with @Grab is: how do you resolve? Need to ensure you
>> resolve it against prod compliant repos. That's why trunk resolver is
>> now pluggable and really better than 1.7.x one which was quite static.
>>
>> Main issue you'll get is then you need to add your jars in
>> classloaders....ie in the finder as well...so too late. We could add
>> an event at the same place as jars.txt parsing but then you'd need 2
>> finders so too much time spent - creating a finder is long - for poor
>> gain compared to what we can already do IMHO, wdyt? That said if
>> that's just for technical libs you can use previous hook to enrich the
>> classloader but it will not be scanned - can be enough for most of
>> technical cases. Last issue: you need to manage libraries conflicts
>>
>>
>>
>>
>>
>> Romain Manni-Bucau
>> @rmannibucau
>> http://www.tomitribe.com
>> http://rmannibucau.wordpress.com
>> https://github.com/rmannibucau
>>
>>
>> 2014-10-24 9:01 GMT+02:00 Alex Soto <as...@gmail.com>:
>> > Well I would do some research on this direction, the question was
>> because I
>> > have wondered myself if it would be possible.
>> >
>> > 2014-10-24 8:56 GMT+02:00 Romain Manni-Bucau <rmannibucau@tomitribe.com
>> >:
>> >
>> >> Would be awesome indeed ;)
>> >>
>> >> just observe (openejb @Observes) BeforeAppInfoBuilderEvent in a custom
>> >> extension and use modules (WebModule for you I guess) finder.
>> >> Romain Manni-Bucau
>> >> Twitter: @rmannibucau
>> >> Blog: http://rmannibucau.wordpress.com/
>> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> >> Github: https://github.com/rmannibucau
>> >>
>> >>
>> >>
>> >> 2014-10-24 8:52 GMT+02:00 Alex Soto <as...@gmail.com>:
>> >> > Hi, today I was thinking a way to implement some @Grab like
>> annotation (
>> >> > http://groovy.codehaus.org/Grape) for Java EE. This could be useful
>> for
>> >> > example to add Hibernate as JavaEE provider or any other library.
>> Because
>> >> > TomEE supports jars.txt approach, I was thinking to use this approach.
>> >> > Something like scan all classpath, finds the "@Grab" annotation
>> crfeate
>> >> the
>> >> > jars.txt and TomEE well do the same. My question is that it would be
>> >> > awesome if we could use the scanning process of TomEE (to not rescan
>> the
>> >> > whole classpath more thanone time).
>> >> >
>> >> > Do you think it is possible?
>> >> >
>> >> > --
>> >> > +----------------------------------------------------------+
>> >> >   Alex Soto Bueno
>> >> >   www.lordofthejars.com
>> >> > +----------------------------------------------------------+
>> >>
>> >
>> >
>> >
>> > --
>> > +----------------------------------------------------------+
>> >   Alex Soto Bueno - Computer Engineer
>> >   www.lordofthejars.com
>> > +----------------------------------------------------------+
>>
>
>
>
> --
> +----------------------------------------------------------+
>   Alex Soto Bueno - Computer Engineer
>   www.lordofthejars.com
> +----------------------------------------------------------+

Re: @Grab like syntax and TomEE

Posted by Alex Soto <as...@gmail.com>.
Yes I am not sure exactly how to do it, for me the best way would be that
meanwhile openejb is scanning the classes when they found a @Grab then it
adds an entry to jars.txt, then jars.txt is copiend into WEB-INF/lib. The
problem is that this process should be done before TomEE reads the jars.txt
file.

2014-10-24 9:13 GMT+02:00 Romain Manni-Bucau <rm...@gmail.com>:

> Main issue with @Grab is: how do you resolve? Need to ensure you
> resolve it against prod compliant repos. That's why trunk resolver is
> now pluggable and really better than 1.7.x one which was quite static.
>
> Main issue you'll get is then you need to add your jars in
> classloaders....ie in the finder as well...so too late. We could add
> an event at the same place as jars.txt parsing but then you'd need 2
> finders so too much time spent - creating a finder is long - for poor
> gain compared to what we can already do IMHO, wdyt? That said if
> that's just for technical libs you can use previous hook to enrich the
> classloader but it will not be scanned - can be enough for most of
> technical cases. Last issue: you need to manage libraries conflicts
>
>
>
>
>
> Romain Manni-Bucau
> @rmannibucau
> http://www.tomitribe.com
> http://rmannibucau.wordpress.com
> https://github.com/rmannibucau
>
>
> 2014-10-24 9:01 GMT+02:00 Alex Soto <as...@gmail.com>:
> > Well I would do some research on this direction, the question was
> because I
> > have wondered myself if it would be possible.
> >
> > 2014-10-24 8:56 GMT+02:00 Romain Manni-Bucau <rmannibucau@tomitribe.com
> >:
> >
> >> Would be awesome indeed ;)
> >>
> >> just observe (openejb @Observes) BeforeAppInfoBuilderEvent in a custom
> >> extension and use modules (WebModule for you I guess) finder.
> >> Romain Manni-Bucau
> >> Twitter: @rmannibucau
> >> Blog: http://rmannibucau.wordpress.com/
> >> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> >> Github: https://github.com/rmannibucau
> >>
> >>
> >>
> >> 2014-10-24 8:52 GMT+02:00 Alex Soto <as...@gmail.com>:
> >> > Hi, today I was thinking a way to implement some @Grab like
> annotation (
> >> > http://groovy.codehaus.org/Grape) for Java EE. This could be useful
> for
> >> > example to add Hibernate as JavaEE provider or any other library.
> Because
> >> > TomEE supports jars.txt approach, I was thinking to use this approach.
> >> > Something like scan all classpath, finds the "@Grab" annotation
> crfeate
> >> the
> >> > jars.txt and TomEE well do the same. My question is that it would be
> >> > awesome if we could use the scanning process of TomEE (to not rescan
> the
> >> > whole classpath more thanone time).
> >> >
> >> > Do you think it is possible?
> >> >
> >> > --
> >> > +----------------------------------------------------------+
> >> >   Alex Soto Bueno
> >> >   www.lordofthejars.com
> >> > +----------------------------------------------------------+
> >>
> >
> >
> >
> > --
> > +----------------------------------------------------------+
> >   Alex Soto Bueno - Computer Engineer
> >   www.lordofthejars.com
> > +----------------------------------------------------------+
>



-- 
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+

Re: @Grab like syntax and TomEE

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Main issue with @Grab is: how do you resolve? Need to ensure you
resolve it against prod compliant repos. That's why trunk resolver is
now pluggable and really better than 1.7.x one which was quite static.

Main issue you'll get is then you need to add your jars in
classloaders....ie in the finder as well...so too late. We could add
an event at the same place as jars.txt parsing but then you'd need 2
finders so too much time spent - creating a finder is long - for poor
gain compared to what we can already do IMHO, wdyt? That said if
that's just for technical libs you can use previous hook to enrich the
classloader but it will not be scanned - can be enough for most of
technical cases. Last issue: you need to manage libraries conflicts





Romain Manni-Bucau
@rmannibucau
http://www.tomitribe.com
http://rmannibucau.wordpress.com
https://github.com/rmannibucau


2014-10-24 9:01 GMT+02:00 Alex Soto <as...@gmail.com>:
> Well I would do some research on this direction, the question was because I
> have wondered myself if it would be possible.
>
> 2014-10-24 8:56 GMT+02:00 Romain Manni-Bucau <rm...@tomitribe.com>:
>
>> Would be awesome indeed ;)
>>
>> just observe (openejb @Observes) BeforeAppInfoBuilderEvent in a custom
>> extension and use modules (WebModule for you I guess) finder.
>> Romain Manni-Bucau
>> Twitter: @rmannibucau
>> Blog: http://rmannibucau.wordpress.com/
>> LinkedIn: http://fr.linkedin.com/in/rmannibucau
>> Github: https://github.com/rmannibucau
>>
>>
>>
>> 2014-10-24 8:52 GMT+02:00 Alex Soto <as...@gmail.com>:
>> > Hi, today I was thinking a way to implement some @Grab like annotation (
>> > http://groovy.codehaus.org/Grape) for Java EE. This could be useful for
>> > example to add Hibernate as JavaEE provider or any other library. Because
>> > TomEE supports jars.txt approach, I was thinking to use this approach.
>> > Something like scan all classpath, finds the "@Grab" annotation crfeate
>> the
>> > jars.txt and TomEE well do the same. My question is that it would be
>> > awesome if we could use the scanning process of TomEE (to not rescan the
>> > whole classpath more thanone time).
>> >
>> > Do you think it is possible?
>> >
>> > --
>> > +----------------------------------------------------------+
>> >   Alex Soto Bueno
>> >   www.lordofthejars.com
>> > +----------------------------------------------------------+
>>
>
>
>
> --
> +----------------------------------------------------------+
>   Alex Soto Bueno - Computer Engineer
>   www.lordofthejars.com
> +----------------------------------------------------------+

Re: @Grab like syntax and TomEE

Posted by Alex Soto <as...@gmail.com>.
Well I would do some research on this direction, the question was because I
have wondered myself if it would be possible.

2014-10-24 8:56 GMT+02:00 Romain Manni-Bucau <rm...@tomitribe.com>:

> Would be awesome indeed ;)
>
> just observe (openejb @Observes) BeforeAppInfoBuilderEvent in a custom
> extension and use modules (WebModule for you I guess) finder.
> Romain Manni-Bucau
> Twitter: @rmannibucau
> Blog: http://rmannibucau.wordpress.com/
> LinkedIn: http://fr.linkedin.com/in/rmannibucau
> Github: https://github.com/rmannibucau
>
>
>
> 2014-10-24 8:52 GMT+02:00 Alex Soto <as...@gmail.com>:
> > Hi, today I was thinking a way to implement some @Grab like annotation (
> > http://groovy.codehaus.org/Grape) for Java EE. This could be useful for
> > example to add Hibernate as JavaEE provider or any other library. Because
> > TomEE supports jars.txt approach, I was thinking to use this approach.
> > Something like scan all classpath, finds the "@Grab" annotation crfeate
> the
> > jars.txt and TomEE well do the same. My question is that it would be
> > awesome if we could use the scanning process of TomEE (to not rescan the
> > whole classpath more thanone time).
> >
> > Do you think it is possible?
> >
> > --
> > +----------------------------------------------------------+
> >   Alex Soto Bueno
> >   www.lordofthejars.com
> > +----------------------------------------------------------+
>



-- 
+----------------------------------------------------------+
  Alex Soto Bueno - Computer Engineer
  www.lordofthejars.com
+----------------------------------------------------------+

Re: @Grab like syntax and TomEE

Posted by Romain Manni-Bucau <rm...@tomitribe.com>.
Would be awesome indeed ;)

just observe (openejb @Observes) BeforeAppInfoBuilderEvent in a custom
extension and use modules (WebModule for you I guess) finder.
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-10-24 8:52 GMT+02:00 Alex Soto <as...@gmail.com>:
> Hi, today I was thinking a way to implement some @Grab like annotation (
> http://groovy.codehaus.org/Grape) for Java EE. This could be useful for
> example to add Hibernate as JavaEE provider or any other library. Because
> TomEE supports jars.txt approach, I was thinking to use this approach.
> Something like scan all classpath, finds the "@Grab" annotation crfeate the
> jars.txt and TomEE well do the same. My question is that it would be
> awesome if we could use the scanning process of TomEE (to not rescan the
> whole classpath more thanone time).
>
> Do you think it is possible?
>
> --
> +----------------------------------------------------------+
>   Alex Soto Bueno
>   www.lordofthejars.com
> +----------------------------------------------------------+