Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Import-Package version matching
Import-Package version matching [message #913121] Fri, 14 September 2012 20:20 Go to next message
Libor Jelinek is currently offline Libor JelinekFriend
Messages: 143
Registered: January 2012
Location: Prague, Czech Rep.
Senior Member

Please consider the following of bundle version resolving issue. Some
plug-in, e.g. com.acme.exports, exports package in MANIFEST.MF like this:

Bundle-SymbolicName: com.acme.exports
...
Export-Package: com.acme.foo,
com.acme.bar,
...

Some other plug-in, e.g. com.acme.imports, imports (consumes)
com.acme.exports's exported packages like:

Bundle-SymbolicName: com.acme.imports
...
Import-Package: com.acome.foo,
com.acme.bar;version="1.3.0",
...

In the example above, com.acme.bar package will not be resolved since it
explicitly requires 1.3.0 version of com.acme.bar but this package
doesn't declare any version.

Is this behavior in accordance with OSGi specification? I'm unsure about
it and I intuitively expected that if there is no exact version match,
the unspecified (and the only) version will be used instead.

Thanks for clarification
Libor
Re: Import-Package version matching [message #913134 is a reply to message #913121] Fri, 14 September 2012 20:52 Go to previous messageGo to next message
Thomas Watson is currently offline Thomas WatsonFriend
Messages: 503
Registered: July 2009
Senior Member
Quote:
Is this behavior in accordance with OSGi specification? I'm unsure about
it and I intuitively expected that if there is no exact version match,
the unspecified (and the only) version will be used instead.


This is in accordance with the OSGi spec. If an import specifies a version then it is saying that the exporter of the package must provide a version that matches the ranges specified on the import.


Quote:

Import-Package: com.acome.foo,
com.acme.bar;version="1.3.0",


Here the bundle is stating that it can only get wired to a package com.acme.bar if and only if that package provides a version >= 1.3.0.

Quote:

Export-Package: com.acme.foo,
com.acme.bar,


These exported packages specify no version so they get a default version of 0.0.0. Since 0.0.0 is not >= 1.3.0 the exported package org.acme.bar cannot be used to resolve the import com.acme.bar;version="1.3.0"

Tom
Re: Import-Package version matching [message #913311 is a reply to message #913134] Sat, 15 September 2012 08:05 Go to previous message
Libor Jelinek is currently offline Libor JelinekFriend
Messages: 143
Registered: January 2012
Location: Prague, Czech Rep.
Senior Member

Thanks for quick and clear reply Thomas!

Libor

On 09/14/2012 10:52 PM, Thomas Watson wrote:
> Quote:
>> Is this behavior in accordance with OSGi specification? I'm unsure
>> about it and I intuitively expected that if there is no exact version
>> match, the unspecified (and the only) version will be used instead.
>
>
> This is in accordance with the OSGi spec. If an import specifies a
> version then it is saying that the exporter of the package must provide
> a version that matches the ranges specified on the import.
>
>
> Quote:
>> Import-Package: com.acome.foo,
>> com.acme.bar;version="1.3.0",
>
>
> Here the bundle is stating that it can only get wired to a package
> com.acme.bar if and only if that package provides a version >= 1.3.0.
>
> Quote:
>> Export-Package: com.acme.foo,
>> com.acme.bar,
>
>
> These exported packages specify no version so they get a default version
> of 0.0.0. Since 0.0.0 is not >= 1.3.0 the exported package org.acme.bar
> cannot be used to resolve the import com.acme.bar;version="1.3.0"
>
> Tom
Previous Topic:Can I use ISchedulingRule as a explicit lock?
Next Topic:Equinox shuts down after 30 seconds of inactivity
Goto Forum:
  


Current Time: Tue Apr 23 09:07:04 GMT 2024

Powered by FUDForum. Page generated in 0.04345 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top