The OSGi Import-Package statement is resolved at runtime, whereas the Maven 
build dependencies are (obviously) resolved at build-time.

At runtime it’s bad to use exact versions, or even an excessively narrow 
version range, since you lose the ability to substitute alternatives, and you 
may be unable to communicate between two components/libraries that would 
otherwise be able to agree to use the same version of an API.

This is one of the biggest misconceptions for people coming to OSGi from build 
systems like Maven. Runtime dependencies are very different to build-time 
dependencies. The best practices for building projects — e.g. making your build 
repeatable and reproducible even far into the future by locking down versions 
exactly — are not best practices at all when it comes to the runtime 
environment.

Regards,
Neil


On 12 October 2014 at 11:58:03, rsteppac2 (r...@steppacher.name) wrote:

Hello,  

the maven-bundle-plugin by default generates import statements for maven  
dependencies with a version range like "[3.0,4)" for a project dependency  
that is declared like this:  

<dependency>  
<groupId>my.group</groupId>  
<artifactId>my-artifact</artifactId>  
<version>${project.version}</version>  
</dependency>  

In this case the exact version (3.0.0.SNAPSHOT) of the dependency is known  
and still the version range is used for the import.  
I found other threads and JIRA tickets discussing the ordering of versions  
with and without classifiers (SNAPSHOT or else) and what would be included  
in a given version range and what not. But I have not found information as  
to why the ranges are used in the first place if the exact version of a  
package is known?  

Could someone point me to a resource explaining this?  

Also, the discussions mention that it is possible to declare the exact  
version of an import. I know that I can do it on a package by package basis  
in the <Import-Package> section of the plugin configuration.  
Is there a configuration option that enables this globally where exact  
versions are known?  


Thanks!  
Ralf  



--  
View this message in context: 
http://apache-felix.18485.x6.nabble.com/Why-import-version-range-if-exact-version-of-dependency-is-known-tp5010123.html
  
Sent from the Apache Felix - Users mailing list archive at Nabble.com.  

---------------------------------------------------------------------  
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org  
For additional commands, e-mail: users-h...@felix.apache.org  

Reply via email to