Hi,

normally shouldn't be a big issue.
For eclipse your embedded jar is a transitive dependency, therefore should
be visible to bundle b (especially since it's a compile scope dependency ;))
second for the Bundle B running in Karaf this should be as simple, as your
building it with the maven-bundle-plugin the needed imports should already
be available in the generated Manifest, you might need to tweek those
depending on how classes are instantiated in Bundle B (getClassForName is a
bad habit people tend to stick to ;) )
Now, it might happen that the maven-bundle-plugin has been a bit to strict
on you when generating the manifest for bundle A which results in a lack of
exports of needed packages. In this case you'll need to add some
configuration to the maven-bundle-plugin, like
<Package-Export>a.b.c.*</Package-Export>

You'll find more details on the maven-bundle-plugin at [1], maybe some of
the POMs from the Pax-Web [2] project or Karaf [3] itself will help you to
understand this plugin better

regards, Achim

[1] -
http://svn.apache.org/repos/asf/felix/releases/maven-bundle-plugin-2.3.7/doc/site/index.html
[2] - https://github.com/ops4j/org.ops4j.pax.web
[3] - https://github.com/apache/karaf


2013/10/22 CLEMENT Jean-Philippe <[email protected]>

> Ok, good :)****
>
> ** **
>
> Now I would like the bundle B (in my previous example), to use a package
> exposed by Bundle A which comes from an embedded jar.****
>
> ** **
>
> I tried to declare A as bundle dependency in the pom of B but the package
> is not seen (classes from this package are not found). Is there a way to do
> so?****
>
> ** **
>
> Thanks again, again!****
>
> JP****
>
> ** **
>
> ** **
>
> *De :* Achim Nierbeck [mailto:[email protected]]
> *Envoyé :* mardi 22 octobre 2013 17:22
> *À :* [email protected]
> *Objet :* Re: maven-bundle-plugin and embedded jar****
>
> ** **
>
> much to complicated :D****
>
> ** **
>
> get rid of thos lib directories first, make sure you have those libs in
> your maven pom instead. ****
>
> second get rid of the MANIFEST.MF let the maven-bundle-plugin do the job
> for your. ****
>
> You should use the POM as your software contract, and it's the only
> contract valid, everything else will ****
>
> be generated by that contract (even eclipse will know of it ;) )****
>
> Regarding the inline=true if the maven-bundle-plugin will find your
> previously "embedded-jars" it will inline ****
>
> those packages inside your newly generated bundle. ****
>
> After that all the Package-Imports and -Exports are calculated by the BND
> included in the maven-bundle-plugin****
>
> ** **
>
> regards, Achim ****
>
> ** **
>
> 2013/10/22 CLEMENT Jean-Philippe <[email protected]
> >****
>
> Dynamic import works perfectly but I’m not too sure what “inline=true”
> does. Packaging jar with Maven does not do any difference. I still need to
> add the Bundle-ClassPath and Export-Package tags as instructions. Eclipse
> still fails to compile without addition of embedded jars in the build path
> libraries.****
>
>  ****
>
> The good point is that adding the Eclipse build path and the two tags
> solve all the problems.****
>
>  ****
>
> Do the maven-bundle-plugin also does the reverse, i.e. exports embedded
> jar to allow compilation of other bundles (*)?****
>
>  ****
>
> (*) Case where:****
>
>  ****
>
> Bundle A (what I do now):****
>
>             +org (…)****
>
>             + lib****
>
>                         + embedded1.jar <-- exported packages****
>
>                         + embedded2.jar****
>
>                         + …****
>
>             + META-INF (…)****
>
>             + OSGI-INF****
>
>  ****
>
> Bundle B:****
>
>             + …****
>
>             + META-INF****
>
>                         + MANIFEST.MF <-- imported packages (of
> embedded1.jar)****
>
>  ****
>
> => Does maven-bundle-plugin allows B to compile?****
>
>  ****
>
> JP****
>
>  ****
>
>  ****
>
> *De :* Achim Nierbeck [mailto:[email protected]]
> *Envoyé :* mardi 22 octobre 2013 16:41
> *À :* [email protected]
> *Objet :* Re: maven-bundle-plugin and embedded jar****
>
>  ****
>
> add this to your  Embed-Dependency tag: inline=true****
>
> This will make sure all packages are inlined in your bundle, makes it
> easier especially since no bundle-classpath is needed.****
>
> I was talking of m2e :D****
>
> Regarding the dynamic-import just add a ****
>
> <Dynamic-Import>x.y.z.*</Dynamic-Import> ****
>
> to make sure your dynamic import range is not the complete classloader ;)*
> ***
>
>  ****
>
> regards, Achim ****
>
>  ****
>
> 2013/10/22 CLEMENT Jean-Philippe <[email protected]
> >****
>
> I use Kepler EE which uses m2e – same as m2eclipse?****
>
>  ****
>
> With the only instruction
> <Embed-Dependency>*;scope=compile;type=!pom</Embed-Dependency> the plugin
> does not generate any Bundle-Classpath entry in the manifest. The
> Import-Package entry is strange as it states a package that is exported and
> one of the embedded jars. I’m not too sure how Karaf will react to this.**
> **
>
>  ****
>
> Moreover, I’m embedding a very old non-osgi code which uses a large amount
> of packages. I would like the plugin to generate the DynamicImport-Package
> entry. How may I do this?****
>
>  ****
>
> Thanks again :)****
>
>  ****
>
> *De :* Achim Nierbeck [mailto:[email protected]]
> *Envoyé :* mardi 22 octobre 2013 16:05
> *À :* [email protected]
> *Objet :* Re: maven-bundle-plugin and embeded jar****
>
>  ****
>
> yes the export-package needs to be adapted. The bundle-classpath should be
> adapted by the plugin/bnd automagically. ****
>
> Actually if you don't configure any import-package and export-packages it
> should export those packages right away. ****
>
> Sometimes it's safest just to declare which package should be "private" by
> private-package and let the plugin do the rest. ****
>
>  ****
>
> If you use the m2eclipse plugin it should work right away with maven and
> eclipse. ****
>
>  ****
>
>  ****
>
> regards, Achim ****
>
>  ****
>
> 2013/10/22 CLEMENT Jean-Philippe <[email protected]
> >****
>
> Maven succeeds !****
>
>  ****
>
> However, Eclipse fails to compile unless I explicitly set them in the java
> build path. Is it normal?****
>
>  ****
>
> PS: So I guess I have to add the export-package and bundle-classpath tags
> accordingly(?)****
>
>  ****
>
> JP****
>
>  ****
>
> *De :* Achim Nierbeck [mailto:[email protected]]
> *Envoyé :* mardi 22 octobre 2013 15:38
> *À :* [email protected]
> *Objet :* Re: maven-bundle-plugin and embeded jar****
>
>  ****
>
> Hi, ****
>
>  ****
>
> usually you should add those as dependencies with maven. ****
>
> If you have the following in your maven-bundle-plugin configuration those
> dependencies are embedded. ****
>
>  ****
>
> <Embed-Dependency>*; scope=compile; type=!pom</Embed-Dependency>****
>
>  ****
>
> and sometimes also helpfull: ****
>
> <Embed-Transitive>true</Embed-Transitive>****
>
>  ****
>
> regards, Achim ****
>
>  ****
>
> 2013/10/22 CLEMENT Jean-Philippe <[email protected]
> >****
>
> In some bundles I have to embed jar files. Do jar files need to be added
> to the Maven repository or may they directly be used from a resource
> directory?****
>
>  ****
>
> JP****
>
>  ****
>
>  ****
>
> *De :* CLEMENT Jean-Philippe [mailto:
> [email protected]]
> *Envoyé :* vendredi 18 octobre 2013 16:02
> *À :* [email protected]
> *Objet :* RE: maven-bundle-plugin and blueprint****
>
>  ****
>
> Great, thanks !****
>
>  ****
>
> JP****
>
>  ****
>
> *De :* Achim Nierbeck [mailto:[email protected]]
> *Envoyé :* vendredi 18 octobre 2013 11:49
> *À :* [email protected]
> *Objet :* Re: maven-bundle-plugin and blueprint****
>
>  ****
>
> Hi Jean-Phillippe, ****
>
>  ****
>
> as long as you have a proper maven structure, it should already be
> included, you don't need a special tag for the maven-bundle-plugin to do
> so. ****
>
>  ****
>
> following structure is usually needed for maven built projects: ****
>
>  ****
>
> /src/main/java****
>
> /src/main/resources/****
>
> /src/test/java****
>
> /src/test/resources****
>
>  ****
>
> just place your blueprint.xml in the /src/main/resources/OSGI-INF/ folder
> and it will be inside your jar/bundle and therefore already in the right
> place to be picked up by the blueprint-extender. ****
>
>  ****
>
> regards, Achim ****
>
>  ****
>
> 2013/10/18 CLEMENT Jean-Philippe <[email protected]
> >****
>
> Dear Karaf Team,
>
> I would like to use Maven (maven-bundle-plugin) as build tool instead of
> Ant.
>
> What would be the best approach to build blueprint-enabled bundles - which
> maven-bundle-plugin tags should I add in the pom in order the blueprint
> files to be included in the bundle?
>
> JP****
>
>
>
> ****
>
>  ****
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/> ****
>
>
>
> ****
>
>  ****
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/> ****
>
>
>
> ****
>
>  ****
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/> ****
>
>
>
> ****
>
>  ****
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/> ****
>
>
>
> ****
>
> ** **
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/> ****
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>

Reply via email to