You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by charbel el_kaed <ch...@hotmail.com> on 2010/05/12 13:29:28 UTC
Maven compile and install on runtime
Hi,
I would like to know if I can do the following with the
maven bundle plugin.
I am generating Java code on the fly and I
would like to compile it and package it in a OSGi-bundle/Jar so another
bundle can start it on the fly.
First I tried using Janino and
took a look on Jasper but then I figure out, that I should reference all
the classpath of dependent packages while compiling and then I have to
write the manifest manually so it can be an OSGi/Jar.
I usually
use maven to build my OSGi bundles, so I thought of using maven to do
so.
So typically I would write a Complier_bundle with a function
Public
JarLocation Compile ( File pom, Path location_of_source)
which will
compile my sources based on a pom.xml and a location of the sources and
would return JarLocation that I can pass it to another bundle to start
the generated bundle.
Anybody has tried to do this? Is there any
documentation on how to do it ?
Thanks and Regards,
Charbel.
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
https://signup.live.com/signup.aspx?id=60969
RE: Maven compile and install on runtime???
Posted by charbel el_kaed <ch...@hotmail.com>.
Hi Craig,
Thx for your reply,
I am trying to install the bnd.jar on a felix framework.
I imported the following packages on the framework
org.osgi.framework.system.packages.extra= sun.rmi.rmic, com.sun.tools.javac, sun.tools.javac, org.apache.env, javax.swing, org.apache.tools.ant, org.apache.tools.ant.types, org.eclipse.jface.text, org.eclipse.ui.texteditor, org.eclipse.core.runtime, org.eclipse.jface.text.source, org.eclipse.jface.resource, org.eclipse.ui, org.eclipse.ui.plugin, org.eclipse.ui.part, org.eclipse.jface.action, org.eclipse.core.resources, org.eclipse.jface.viewers, org.eclipse.swt.widgets, org.eclipse.jface.dialogs
The bundle has a resolved state and when starting it I am having the following error:
-----------------------------------------------------------------------------------------------------
org.osgi.framework.BundleException: Activator start error in bundle biz.aQute.bnd [44].
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1807)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1682)
at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
at org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:114)
at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:286)
at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:184)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/eclipse/ui/plugin/AbstractUIPlugin
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1872)
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:758)
at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1733)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:674)
at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3550)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1755)
... 6 more
Caused by: java.lang.ClassNotFoundException: org.eclipse.ui.plugin.AbstractUIPlugin
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.apache.felix.framework.ExtensionManager$ExtensionManagerModule.getClassByDelegation(ExtensionManager.java:682)
at org.apache.felix.framework.searchpolicy.R4Wire.getClass(R4Wire.java:108)
at org.apache.felix.framework.ModuleImpl.searchImports(ModuleImpl.java:1440)
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:753)
at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1733)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 17 more
java.lang.NoClassDefFoundError: org/eclipse/ui/plugin/AbstractUIPlugin
----------------------------------------------------------------------------------------------------------------------------
Do you have an idea how can I make it run ?
Thanks and Regards.
Charbel.
> Subject: RE: Maven compile and install on runtime???
> Date: Wed, 12 May 2010 16:11:04 -0400
> From: lcphillips@praxiseng.com
> To: dev@felix.apache.org
>
> Hi, absolutely... If you'll notice, the only thing that is pre-built in the entire framework is the system bundle itself... everything else is pure source... There is a 1.6 "builder" that intercepts the "installBundle" and will compile any "denoted source bundle"... Therefore, if you create a pure source bundle on the fly, and simply do an installBundle on that, it will be thrown to the "builder" and thus be installed...
>
> Keep in mind, this is a demonstration only... The framework source was from last October off the trunk (the shell tui is funky -- it doesn't echo... I presume they got that fixed)...
>
> And, of course, to reiterate.. the dip powers that be had no clue what a valuable feature set this is...
>
> I am thoroughly convinced the only way to make progress is to throw out the bathwater and everything in it and start from scratch with OSGI-II...
>
> ________________________________
>
> From: charbel el_kaed [mailto:charbel_el_kaed@hotmail.com]
> Sent: Wed 5/12/2010 8:58 AM
> To: dev@felix.apache.org
> Subject: RE: Maven compile and install on runtime???
>
>
>
>
>
>
> Hi
> Craig,
>
> Thanks for the link.
>
> But can I do the compilation and packaging on the fly from a running OSGi-Bundle ?
>
> Regards,
> Charbel
>
> _________________________________________________________________
> Hotmail: Powerful Free email with security by Microsoft.
> https://signup.live.com/signup.aspx?id=60969
>
_________________________________________________________________
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
RE: Maven compile and install on runtime???
Posted by Craig Phillips <lc...@praxiseng.com>.
Hi, absolutely... If you'll notice, the only thing that is pre-built in the entire framework is the system bundle itself... everything else is pure source... There is a 1.6 "builder" that intercepts the "installBundle" and will compile any "denoted source bundle"... Therefore, if you create a pure source bundle on the fly, and simply do an installBundle on that, it will be thrown to the "builder" and thus be installed...
Keep in mind, this is a demonstration only... The framework source was from last October off the trunk (the shell tui is funky -- it doesn't echo... I presume they got that fixed)...
And, of course, to reiterate.. the dip powers that be had no clue what a valuable feature set this is...
I am thoroughly convinced the only way to make progress is to throw out the bathwater and everything in it and start from scratch with OSGI-II...
________________________________
From: charbel el_kaed [mailto:charbel_el_kaed@hotmail.com]
Sent: Wed 5/12/2010 8:58 AM
To: dev@felix.apache.org
Subject: RE: Maven compile and install on runtime???
Hi
Craig,
Thanks for the link.
But can I do the compilation and packaging on the fly from a running OSGi-Bundle ?
Regards,
Charbel
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969
RE: Maven compile and install on runtime
Posted by charbel el_kaed <ch...@hotmail.com>.
Hi
Craig,
Thanks for the link.
But can I do the compilation and packaging on the fly from a running OSGi-Bundle ?
Regards,
Charbel
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969
RE: Maven compile and install on runtime
Posted by Craig Phillips <lc...@praxiseng.com>.
I've been pushing the notion of source bundles to the "powers that be" to no avail...
Here's a demo (windoze only ATT):
http://www.box.net/shared/4jssc5r69c
Let the framework do the build, as it should... after all, the framework IS the convention...
You would simply generate the java, zip it / jar it, and "install" it...
Regards
From: charbel el_kaed
Sent: Wed 5/12/2010 7:29 AM
To: dev@felix.apache.org; users@felix.apache.org
Subject: Maven compile and install on runtime
Hi,
I would like to know if I can do the following with the
maven bundle plugin.
I am generating Java code on the fly and I
would like to compile it and package it in a OSGi-bundle/Jar so another
bundle can start it on the fly.
First I tried using Janino and
took a look on Jasper but then I figure out, that I should reference all
the classpath of dependent packages while compiling and then I have to
write the manifest manually so it can be an OSGi/Jar.
I usually
use maven to build my OSGi bundles, so I thought of using maven to do
so.
So typically I would write a Complier_bundle with a function
Public
JarLocation Compile ( File pom, Path location_of_source)
which will
compile my sources based on a pom.xml and a location of the sources and
would return JarLocation that I can pass it to another bundle to start
the generated bundle.
Anybody has tried to do this? Is there any
documentation on how to do it ?
Thanks and Regards,
Charbel.
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
https://signup.live.com/signup.aspx?id=60969