Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Advice: OSGi'fy jars into target platform or Classpath and included in bundle?

On Tue, May 29, 2012 at 8:53 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
> I use maven-bundle-plugin Embed-Dependency feature [1] to "wrap"
> thirdpary dependencies in OSGi bundles and pomDependencies=consider [2]
> Tycho target platform configuration parameter to use these wrapper
> bundles from Tycho builds. See m2e embedded maven runtime, for example [3].
>
> The only real caveat here is that wrapper bundles must be built
> separately, before building any tycho project that uses them.
>
>
> [1] http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
> [2]
> https://docs.sonatype.org/display/TYCHO/Dependency+on+pom-first+artifacts
> [3]
> http://git.eclipse.org/c/m2e/m2e-core.git/tree/?id=milestones/1.1/1.1.0.20120505-1126

How do target platforms fit into all this?

This stuff is making my head hurt, so I'm probably not very lucid in
explaining what I am trying to do.

I had hoped I could
* Wrap the bundles
* Generate P2 data for them
* Update my Target definition with extra <unit/>s for each new dependency
* Update my plugin's MANIFEST.MF to include each new new dependency

Again, perhaps because I am trying to take a shortcut, I thought I
would just grab the already OSGi'fied bundles at
http://ebr.springsource.com/repository/app/faq#q8
But that won't have P2 data.
I tried proxying these in Nexus and use the P2 metadata generator but
that doesn't seem to be working (probably because I don't really
understand what its doing, I think it generates the data on insertion
into the repository so probably doesn't work on proxied repositories)

So instead I have managed to get rid of one embedded dependency by:
* Create a pom that specifies the spring repository and a dependency
to an OSGi'fied jar available there.
* Use maven-dependency-plugin to copy the dependencies to lib/
* Manually upload this dependency into our local Nexus, into a
repository that has the Experimental P2 plugins enabled on it.  This
will generate the p2 meta data required. (I used a different group to
keep them separate from the spring stuff)
* Delete the use of an embedded jar from .classpath, build.properties,
MANIFEST.MF and bin.includes.
* Add the dependency to the target platform (and reload if necessary)
* Add the dependency to the Required-Bundle of the plugin
* Rebuild plugin in Eclipse (should work)
* Rebuild application with Maven and validate product.zip file runs correctly.

So I will keep going and removing other dependencies.

I'm not sure what is going to happen with these:
1) SNAPSHOT dependencies on other projects we develop
2) SNAPSHOT dependencies within the current maven build

My target platform file uses remote http locations, which obviously
wont have the latest SNAPSHOT versions.


Back to the top