I looked into this a tiny bit more.  I think we'd start with the 
EclipseJavaCompiler at 
https://svn.codehaus.org/plexus/trunk/plexus-components/plexus-compiler/plexus-compilers/plexus-compiler-eclipse
 and modify the way it constructs a classloader in the compile method:

        ClassLoader classLoader = new URLClassLoader( urls );

to something that started a framework, loaded all the urls as bundles, kept 
track of the exports, and constructed a bundle that had all the exports as 
imports, and then got the bundle classloader.

Anyone familiar enough with tycho to know if it has code like that inside?  It 
doesn't seem like it would be all that hard to write from scratch...

thanks
david jencks


On Nov 25, 2011, at 3:57 AM, Holly Cummins wrote:

> I think this is an interesting idea, David. The Maven Tycho plugin
> does an OSGi-aware compilation, and there might be something there we
> can start from. Tycho itself isn't right for us, because it's a
> manifest-first technology - it works from a special bundle-aware
> repository and the manifest of the bundle being compiled, and we don't
> have either of those! However, there might be something in the
> compilation mechanism that we could re-use/cannibalise/draw
> inspiration from. In the worst case a two phase compilation with Tycho
> working from the manifest generated by bnd might add *some* value,
> although it would be pretty tortuous.
> 
> Holly
> ---
> Want to read more?
> http://www.manning.com/cummins/ - Enterprise OSGi in Action
> 
> On Thu, Nov 24, 2011 at 7:14 PM, David Jencks <[email protected]> wrote:
>> We've had some problems lately with stuff like packages no longer being 
>> exported and this turning out to break other projects. I've been wondering 
>> what would make problems like this more visible sooner and also wondering 
>> what could be done to make maven more osgi friendly.  So, here's an idea 
>> that might or might not be workable or useful.
>> 
>> The eclipse compiler lets you supply a classloader as the "parent" rather 
>> than the javac requiring that you supply a classpath.  So what if there was 
>> a maven compiler configuration that would supply a classloader to the 
>> eclipse compiler that worked with the maven dependencies as bundles, i.e. 
>> was a bundle classloader for a more-or-less fake bundle that imports all the 
>> exports of the maven dependency bundles?
>> 
>> thoughts?
>> 
>> thanks
>> david jencks
>> 
>> 
>> 
>> 

Reply via email to