You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Benson Margulies <be...@basistech.com> on 2014/12/11 18:38:27 UTC
Bundle dependency management
So, here I am, setting up an application that embeds Felix. I need it
to contain a certain collection of bundles -- and then some
dependencies of those bundles.
Plain-old-maven can't help very much with managing those dependencies,
since it can only deal with one version per Group/Artifact, and I
expect to have cases where we need more than one major version of some
things (e.g. Guava).
is there a commonly-used solution to all of this? I'm contemplating
writing a Maven plugin, but I would like to avoid recreating the
wheel.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Bundle dependency management
Posted by Christian Schneider <ch...@die-schneider.net>.
That looks pretty good.
Christian
Am 12.12.2014 21:05, schrieb Paulo Renato de Athaydes:
> Hi,
>
> I thought you just wanted to easily create a Felix runtime for your OSGi bundles?
>> So, here I am, setting up an application that embeds Felix. I need it
>> to contain a certain collection of bundles -- and then some
>> dependencies of those bundles.
> Using osgi-run, this Gradle script will install 2 different versions of Guava and run everything with Felix:
>
> build.gradle
> ######################
> buildscript {
> repositories {
> jcenter()
> }
> dependencies {
> classpath "com.athaydes.gradle.osgi:osgi-run-core:1.1"
> }
> }
>
> repositories { mavenCentral() }
>
> apply plugin: 'osgi-run'
>
> dependencies { // some examples of bundles
> osgiRuntime 'com.google.guava:guava:12.0'
> osgiRuntime 'com.google.guava:guava:16.0'
> }
> ########################
>
> The bundles, specified by their artifact coordinates in "osgiRuntime", will be downloaded from the repositories you configured (Maven or Ivy repos, local files etc, see http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories) and added to the OSGi environment. Notice you can have as many of the same artifact with different versions as you want.
>
> Sorry if I misunderstand you.
>
>
> Regards,
>
> Renato
>
>
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
Talend Application Integration Division http://www.talend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
RE: Bundle dependency management
Posted by Paulo Renato de Athaydes <re...@hotmail.com>.
Hi,
I thought you just wanted to easily create a Felix runtime for your OSGi bundles?
> So, here I am, setting up an application that embeds Felix. I need it
> to contain a certain collection of bundles -- and then some
> dependencies of those bundles.
Using osgi-run, this Gradle script will install 2 different versions of Guava and run everything with Felix:
build.gradle
######################
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.athaydes.gradle.osgi:osgi-run-core:1.1"
}
}
repositories { mavenCentral() }
apply plugin: 'osgi-run'
dependencies { // some examples of bundles
osgiRuntime 'com.google.guava:guava:12.0'
osgiRuntime 'com.google.guava:guava:16.0'
}
########################
The bundles, specified by their artifact coordinates in "osgiRuntime", will be downloaded from the repositories you configured (Maven or Ivy repos, local files etc, see http://www.gradle.org/docs/current/userguide/dependency_management.html#sec:repositories) and added to the OSGi environment. Notice you can have as many of the same artifact with different versions as you want.
Sorry if I misunderstand you.
Regards,
Renato
> Date: Fri, 12 Dec 2014 07:44:36 -0500
> Subject: Re: Bundle dependency management
> From: benson@basistech.com
> To: users@felix.apache.org
>
> On Fri, Dec 12, 2014 at 4:58 AM, Robert Munteanu <ro...@apache.org> wrote:
> > https://ops4j1.jira.com/wiki/display/paxrunner/Pax+Runner
>
> One idea I think I'm learning from all this is that a typical process
> is to preload an OSGi container and deliver it. I've been thinking in
> terms of delivering a pile of bundles and loading them up on the fly.
>
> I see how Pax+Runner fits in here. It is unfortunate that
> https://ops4j1.jira.com/wiki/display/paxrunner/Provision+bundles+from+a+Maven+POM+file
> is an empty page (along with a bunch of other pages.)
>
> I also want to return to the original schema I had for a Maven plugin
> in the context of what I've learned from all of you.
>
> In general, there is no global resource of OBR metadata. Given an
> arbitrary bundle with arbitrary imports, there's no simple way to
> locating bundles 'in the wide world', let alone select between them,
> that satisfy the imports.
>
> However, in a constrained environment, with (for example) Nexus, you
> could imagine having enough ORB metadata to fulfill dependencies. It
> looks as if pax-runner can, in that circumstance, do the job. But
> that's a bunch of work to make sure that the 'wide world' things that
> one needs are locally OBR-indexed.
>
> That leaves me with a variation on my original idea, which is a
> complement to the existing maven-bundle-plugin.
>
> The maven-bundle-plugin starts from the thought that all, or pretty
> nearly all, of the OSGi bundles that you need are, in fact, Maven
> artifacts. It's core behavior applies bnd to Maven dependencies. I'm
> imagining, essentially, one more goal: copy-dependent-bundles. The
> idea of this goal is to circumvent the Maven restriction to one
> version at a time in the dependency graph. It's not completely general
> would be helpful in the case where the Maven dependency graph does, in
> fact, describe the OSGi bundles required.
>
> The configuration of this goal would look like dependency:copy: a list
> of artifactItems, one for each of the bundles that you know that you
> want. For each one, the plugin would obtain the dependency graph, but
> not resolve it, thus avoiding the collapse of multiple versions. it
> would download those dependencies, and then you've got a stack of
> bundles you can provision into your container.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
Re: Bundle dependency management
Posted by Benson Margulies <be...@basistech.com>.
On Fri, Dec 12, 2014 at 4:58 AM, Robert Munteanu <ro...@apache.org> wrote:
> https://ops4j1.jira.com/wiki/display/paxrunner/Pax+Runner
One idea I think I'm learning from all this is that a typical process
is to preload an OSGi container and deliver it. I've been thinking in
terms of delivering a pile of bundles and loading them up on the fly.
I see how Pax+Runner fits in here. It is unfortunate that
https://ops4j1.jira.com/wiki/display/paxrunner/Provision+bundles+from+a+Maven+POM+file
is an empty page (along with a bunch of other pages.)
I also want to return to the original schema I had for a Maven plugin
in the context of what I've learned from all of you.
In general, there is no global resource of OBR metadata. Given an
arbitrary bundle with arbitrary imports, there's no simple way to
locating bundles 'in the wide world', let alone select between them,
that satisfy the imports.
However, in a constrained environment, with (for example) Nexus, you
could imagine having enough ORB metadata to fulfill dependencies. It
looks as if pax-runner can, in that circumstance, do the job. But
that's a bunch of work to make sure that the 'wide world' things that
one needs are locally OBR-indexed.
That leaves me with a variation on my original idea, which is a
complement to the existing maven-bundle-plugin.
The maven-bundle-plugin starts from the thought that all, or pretty
nearly all, of the OSGi bundles that you need are, in fact, Maven
artifacts. It's core behavior applies bnd to Maven dependencies. I'm
imagining, essentially, one more goal: copy-dependent-bundles. The
idea of this goal is to circumvent the Maven restriction to one
version at a time in the dependency graph. It's not completely general
would be helpful in the case where the Maven dependency graph does, in
fact, describe the OSGi bundles required.
The configuration of this goal would look like dependency:copy: a list
of artifactItems, one for each of the bundles that you know that you
want. For each one, the plugin would obtain the dependency graph, but
not resolve it, thus avoiding the collapse of multiple versions. it
would download those dependencies, and then you've got a stack of
bundles you can provision into your container.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Bundle dependency management
Posted by Robert Munteanu <ro...@apache.org>.
Hi Benson,
On Thu, 2014-12-11 at 12:38 -0500, Benson Margulies wrote:
> So, here I am, setting up an application that embeds Felix. I need it
> to contain a certain collection of bundles -- and then some
> dependencies of those bundles.
>
> Plain-old-maven can't help very much with managing those dependencies,
> since it can only deal with one version per Group/Artifact, and I
> expect to have cases where we need more than one major version of some
> things (e.g. Guava).
>
> is there a commonly-used solution to all of this? I'm contemplating
> writing a Maven plugin, but I would like to avoid recreating the
> wheel.
In the Apache Sling project we have a concept called 'slingstart' which
allows you define the artifacts that you want to package and also OSGi
configs that you want to include by default. You can see some samples at
[1]. There's a Maven plugin for that as well at [2] .
Another option that I've used - but only for demo purposes so far - is
Pax Runner [3]. It's advertised mostly as a development-time tool, but
with a little tweaking it can be used to generate deployment packages.
Cheers,
Robert
[1]:
https://svn.apache.org/repos/asf/sling/trunk/tooling/support/provisioning-model/src/test/resources/
[2]:
https://svn.apache.org/repos/asf/sling/trunk/tooling/maven/slingstart-maven-plugin/
[3]: https://ops4j1.jira.com/wiki/display/paxrunner/Pax+Runner
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Bundle dependency management
Posted by Marcel Offermans <ma...@luminis.nl>.
What I was trying to say, before incidentally hitting “send”…
Hello Christian,
On 12 Dec 2014 at 16:06:02 , Christian Schneider (chris@die-schneider.net) wrote:
I am especially interested in using maven central as most of the apache
projects are only available there.
I’m sorry, but this is simply not true. All Apache projects are actually required to publish their releases to apache.org/dist from where it will be picked up to all the mirrors connected to that.
Publishing to Maven Central is completely optional (as is publishing anywhere else).
Greetings, Marcel
Re: Bundle dependency management
Posted by Marcel Offermans <ma...@luminis.nl>.
Hello Christian,
On 12 Dec 2014 at 16:06:02 , Christian Schneider (chris@die-schneider.net) wrote:
I am especially interested in using maven central as most of the apache
projects are only available there.
Christian
On 12.12.2014 15:04, Neil Bartlett wrote:
> This is just one way of configuring your workspace. We have a flexible
> repository model that can resolve dependencies from remote
> repositories or checked-in JARs. We tend to use the checked-in JAR
> approach for certain demo or training environments (e.g. at
> conferences) where it can be risky to rely on a workable internet
> connection.
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Bundle dependency management
Posted by Neil Bartlett <nj...@gmail.com>.
> On 12 Dec 2014, at 14:10, Christian Schneider <ch...@die-schneider.net> wrote:
>
> Sounds interesting. Do you have some demo or documentation about the possible repositories.
> I am especially interested in using maven central as most of the apache projects are only available there.
Christian, if you create a Bndtools workspace using either the JPM4J or OSGi en Route configurations (these are built-in), then you will get a repository link to jpm4j.org, which aggregates over the entire of Maven Central as well as several other locations.
Regards,
Neil
>
> Christian
>
> On 12.12.2014 15:04, Neil Bartlett wrote:
>> This is just one way of configuring your workspace. We have a flexible repository model that can resolve dependencies from remote repositories or checked-in JARs. We tend to use the checked-in JAR approach for certain demo or training environments (e.g. at conferences) where it can be risky to rely on a workable internet connection.
>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Bundle dependency management
Posted by Christian Schneider <ch...@die-schneider.net>.
Sounds interesting. Do you have some demo or documentation about the
possible repositories.
I am especially interested in using maven central as most of the apache
projects are only available there.
Christian
On 12.12.2014 15:04, Neil Bartlett wrote:
> This is just one way of configuring your workspace. We have a flexible
> repository model that can resolve dependencies from remote
> repositories or checked-in JARs. We tend to use the checked-in JAR
> approach for certain demo or training environments (e.g. at
> conferences) where it can be risky to rely on a workable internet
> connection.
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Bundle dependency management
Posted by Neil Bartlett <nj...@gmail.com>.
On Fri, Dec 12, 2014 at 10:19 AM, Christian Schneider <
chris@die-schneider.net> wrote:
>
> I also think the impedance mismatch between maven and osgi is a big
> problem when doing OSGi work.
>
> What I do not like though in the bndtools projects I saw till now is that
> they all seem to contain a complete set of jars inside the checked in
> source.
> I know they use this to populate the obr (or similar) repository they then
> work with.
>
> This kind of setting up your environment reminds me a lot of the pre maven
> era and I think it is a step back. Is there some better solution to this?
> I would at least want all my jars to come from maven so they do not
> pollute git.
>
This is just one way of configuring your workspace. We have a flexible
repository model that can resolve dependencies from remote repositories or
checked-in JARs. We tend to use the checked-in JAR approach for certain
demo or training environments (e.g. at conferences) where it can be risky
to rely on a workable internet connection.
>
> A similar thing applies for most of the eclipse projects. Most of them
> seem to use tycho even when they are completely server side. In the end
> they provide their jars in eclipse features that contain the whole wars.
> Most of the time they also do not seem to publish to maven central. So in
> the end you have a mixture of dependencies that are only in maven and some
> that are only in eclipse update sites. This is a really bad situation.
>
> Christian
>
>
> On 12.12.2014 04:40, David Jencks wrote:
>
>> Hopefully you are not using any require-bundle headers.
>>
>> So you can think in terms of package requirements rather than bundle
>> dependencies. OBR is pretty much the solution to this, but AFAIK there is
>> no reasonable way to automate figuring out what set of bundles should be in
>> your repository. IIRC some versions of nexus (maybe all by now) can
>> generate an xml file for obr, but I don't think running obr against maven
>> central is likely to produce results you are happy with.
>>
>> After being a maven fanatic for many years I now think the impedance
>> mismatches between maven and osgi are pretty large and given a free hand
>> with a project would probably use a gradle + bndtools build with a local
>> file system repository (generally under "cnf" in these builds IIUC for
>> reasons I don't know).
>>
>> hopefully I haven't misunderstood your question too much...
>> david jencks
>>
>>
>> On Dec 11, 2014, at 12:38 PM, Benson Margulies <be...@basistech.com>
>> wrote:
>>
>> So, here I am, setting up an application that embeds Felix. I need it
>>> to contain a certain collection of bundles -- and then some
>>> dependencies of those bundles.
>>>
>>> Plain-old-maven can't help very much with managing those dependencies,
>>> since it can only deal with one version per Group/Artifact, and I
>>> expect to have cases where we need more than one major version of some
>>> things (e.g. Guava).
>>>
>>> is there a commonly-used solution to all of this? I'm contemplating
>>> writing a Maven plugin, but I would like to avoid recreating the
>>> wheel.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
Re: Bundle dependency management
Posted by Christian Schneider <ch...@die-schneider.net>.
I also think the impedance mismatch between maven and osgi is a big
problem when doing OSGi work.
What I do not like though in the bndtools projects I saw till now is
that they all seem to contain a complete set of jars inside the checked
in source.
I know they use this to populate the obr (or similar) repository they
then work with.
This kind of setting up your environment reminds me a lot of the pre
maven era and I think it is a step back. Is there some better solution
to this?
I would at least want all my jars to come from maven so they do not
pollute git.
A similar thing applies for most of the eclipse projects. Most of them
seem to use tycho even when they are completely server side. In the end
they provide their jars in eclipse features that contain the whole wars.
Most of the time they also do not seem to publish to maven central. So
in the end you have a mixture of dependencies that are only in maven and
some that are only in eclipse update sites. This is a really bad situation.
Christian
On 12.12.2014 04:40, David Jencks wrote:
> Hopefully you are not using any require-bundle headers.
>
> So you can think in terms of package requirements rather than bundle dependencies. OBR is pretty much the solution to this, but AFAIK there is no reasonable way to automate figuring out what set of bundles should be in your repository. IIRC some versions of nexus (maybe all by now) can generate an xml file for obr, but I don't think running obr against maven central is likely to produce results you are happy with.
>
> After being a maven fanatic for many years I now think the impedance mismatches between maven and osgi are pretty large and given a free hand with a project would probably use a gradle + bndtools build with a local file system repository (generally under "cnf" in these builds IIUC for reasons I don't know).
>
> hopefully I haven't misunderstood your question too much...
> david jencks
>
>
> On Dec 11, 2014, at 12:38 PM, Benson Margulies <be...@basistech.com> wrote:
>
>> So, here I am, setting up an application that embeds Felix. I need it
>> to contain a certain collection of bundles -- and then some
>> dependencies of those bundles.
>>
>> Plain-old-maven can't help very much with managing those dependencies,
>> since it can only deal with one version per Group/Artifact, and I
>> expect to have cases where we need more than one major version of some
>> things (e.g. Guava).
>>
>> is there a commonly-used solution to all of this? I'm contemplating
>> writing a Maven plugin, but I would like to avoid recreating the
>> wheel.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
--
Christian Schneider
http://www.liquid-reality.de
Open Source Architect
http://www.talend.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Bundle dependency management
Posted by David Jencks <da...@yahoo.com.INVALID>.
Hopefully you are not using any require-bundle headers.
So you can think in terms of package requirements rather than bundle dependencies. OBR is pretty much the solution to this, but AFAIK there is no reasonable way to automate figuring out what set of bundles should be in your repository. IIRC some versions of nexus (maybe all by now) can generate an xml file for obr, but I don't think running obr against maven central is likely to produce results you are happy with.
After being a maven fanatic for many years I now think the impedance mismatches between maven and osgi are pretty large and given a free hand with a project would probably use a gradle + bndtools build with a local file system repository (generally under "cnf" in these builds IIUC for reasons I don't know).
hopefully I haven't misunderstood your question too much...
david jencks
On Dec 11, 2014, at 12:38 PM, Benson Margulies <be...@basistech.com> wrote:
> So, here I am, setting up an application that embeds Felix. I need it
> to contain a certain collection of bundles -- and then some
> dependencies of those bundles.
>
> Plain-old-maven can't help very much with managing those dependencies,
> since it can only deal with one version per Group/Artifact, and I
> expect to have cases where we need more than one major version of some
> things (e.g. Guava).
>
> is there a commonly-used solution to all of this? I'm contemplating
> writing a Maven plugin, but I would like to avoid recreating the
> wheel.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
Re: Bundle dependency management
Posted by Benson Margulies <be...@basistech.com>.
I am already building bundles with Maven and the maven-bundle-plugin,
which uses bnd. The point of this query is that OSGi dependency
management is clearly not quite the same thing as Maven.
In the maven dependency graph, once resolved, there can only be one
version for a given Group/Artifact. In OSGi, you can have many version
of the same bundle.
So, starting from a set of root bundles, even expressed as Maven
dependencies, it's not obvious how to inventory the required bundles.
And that's not even counting the possibility of using a bundle that
has no associated Maven POM, and thus offers no particular clue as to
where to find a bundle that exports the packages that it imports.
I know that Tycho tries to insert this sort of thing into Maven, but
my prior experience with Tycho was not very encouraging.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org
RE: Bundle dependency management
Posted by Paulo Renato de Athaydes <re...@hotmail.com>.
Hi,
Looks like you need one of these:
bnd-tools:
http://bndtools.org/
If you use Maven, just use the maven bundle plugin, and write your own Felix bootstrapper (the the example in the Felix docs - this is the hard way):
http://wiki.osgi.org/wiki/Maven_Bundle_Plugin
osgi-run:
https://github.com/renatoathaydes/osgi-run
If you just want to avoid Maven and Eclipse (like me) and you like Gradle, try this gradle plugin I wrote.
It will create an OSGi environment for you with as little as this in a "build.gradle" file:
##################
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.athaydes.gradle.osgi:osgi-run-core:1.1"
}
}
repositories { mavenCentral() } // you can use mavenLocal(), jcenter() etc... see gradle docs
apply plugin: 'osgi-run'
dependencies { // some examples of bundles to deploy with their (bundle) dependencies
osgiRuntime 'org.osgi:org.osgi.core:4.3.1'
osgiRuntime 'org.apache.pdfbox:pdfbox:1.8.6'
osgiRuntime 'commons-logging:commons-logging:1.2'
}
##################
Now, to create an environment (you need gradle installed):
gradle createOsgiRuntime
Then, to run:
cd build/osgi
run.bat # or ./run.sh or ./run.command
Remove everything with:
gradle clean
By default, it will use Felix to run everything and will install the gogo bundles so you can type "lb" for example to see the installed bundles, but you can easily configure it to use Equinox or something else, or to not install transitive bundle dependencies, or not install gogo etc... See the README page.
Renato
> Date: Thu, 11 Dec 2014 12:38:27 -0500
> Subject: Bundle dependency management
> From: benson@basistech.com
> To: users@felix.apache.org
>
> So, here I am, setting up an application that embeds Felix. I need it
> to contain a certain collection of bundles -- and then some
> dependencies of those bundles.
>
> Plain-old-maven can't help very much with managing those dependencies,
> since it can only deal with one version per Group/Artifact, and I
> expect to have cases where we need more than one major version of some
> things (e.g. Guava).
>
> is there a commonly-used solution to all of this? I'm contemplating
> writing a Maven plugin, but I would like to avoid recreating the
> wheel.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>