For now you could also use an explicit open version range, such as:

<Import-Package>javax.servlet;version=0,javax.servlet.http;version=0</Import-Package>

or use the version policy to do the same for all imports:

<_consumer-policy>0</_consumer-policy>

last resort option would be to hide the dependency from bnd:

<!-- list of artifactIds to exclude from the bnd classpath -->
<excludeDependencies>servlet-api</excludeDependencies>

note this goes outside of the instructions section - it effectively hinders bnd 
by holding back information (which is why it’s a last resort option)  

On Friday, 23 January 2015 at 15:56, Felix Meschberger wrote:

> Hi
>  
> One option is to have a maven dependency which does not expose the package 
> export version number. For example, IIRC, the original javax.servlet is not 
> really a bundle and those not have export version numbers.
>  
> Another idea, and that would maybe be an extension to BND itself (if not 
> already existing), is that if a dependency happens to both have export 
> version numbers *and* Provide-Capability, then BND would generate a 
> version-less import but add a Require-Capability ??
>  
> Regards
> Felix
>  
>  
> > Am 23.01.2015 um 16:51 schrieb David Bosschaert <david.bosscha...@gmail.com 
> > (mailto:david.bosscha...@gmail.com)>:
> >  
> > Hi all,
> >  
> > I'm using maven-bundle-plugin 2.5.3 to create a bundle the uses the
> > javax.servlet APIs. As explained in [1] I want to use a portable
> > contract for the javax.servlet package, as defined in [2].
> > I can easily require the contract using the maven bundle plugin, but
> > what I can't seem to achieve is import the javax.servlet package
> > without a version range. My maven bundle plugin configuration looks
> > like this:
> >  
> > <configuration>
> > <instructions>
> > <Import-Package>javax.servlet,javax.servlet.http</Import-Package>
> > <Require-Capability>osgi.contract;filter:="(&amp;(osgi.contract=JavaServlet)(version=3.0))"</Require-Capability>
> > </instructions>
> > </configuration>
> >  
> > However, the import package is always generated *with* version
> > numbers, I always get somthing like:
> > Import-Package:
> > javax.servlet;version="[3.0,4)",javax.servlet.http;version="[3.0,4)"
> >  
> > As explained in [1] and [2], for packages defined by organisations
> > that do not follow semantic versioning I should import the package
> > without version and let the osgi.contract require-capability associate
> > it with the right version for me.
> >  
> > Question is, how do I configure the maven bundle plugin to avoid these
> > versions on imported packages?
> >  
> > Thanks,
> >  
> > David
> >  
> > [1] http://blog.osgi.org/2014/09/portable-java-contracts-for-javax.html
> > [2] http://www.osgi.org/Specifications/ReferenceContract
> >  
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org 
> > (mailto:users-unsubscr...@felix.apache.org)
> > For additional commands, e-mail: users-h...@felix.apache.org 
> > (mailto:users-h...@felix.apache.org)
> >  
>  
>  
>  
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org 
> (mailto:users-unsubscr...@felix.apache.org)
> For additional commands, e-mail: users-h...@felix.apache.org 
> (mailto:users-h...@felix.apache.org)
>  
>  


Reply via email to