You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Ian Boston <ie...@tfd.co.uk> on 2012/11/03 01:30:24 UTC

Strange package-info.java behaviour.

Hi,
I almost added a package-info.java below, but stopped.

@Version("2.2.0")
package org.apache.sling.commons.osgi;

import aQute.bnd.annotation.Version;

and removed the instructions from the pom.xml, until i inspected the
manifest which went from

Export-Package: org.apache.sling.commons.osgi;uses:="org.osgi.service.ev
 ent,org.osgi.framework,org.osgi.util.tracker";version="2.2.0"

to

Export-Package: org.apache.sling.commons.osgi;uses:="org.osgi.service.ev
 ent,org.osgi.framework,org.osgi.util.tracker";version="2.2.0",org.apach
 e.sling.commons.osgi.bundleversion;uses:="org.osgi.framework";version="
 2.1.1.SNAPSHOT"


It seems like switching to  package-info.java caused all child
packages to be exported with a default version matching the bundle
version.

Is that the expected behaviour, and if so, how do you stop it
happening? The doc on the annotations (or the source code) is not that
revealing.

Ian

Re: Strange package-info.java behaviour.

Posted by Felix Meschberger <fm...@adobe.com>.
Hi

What version of the bundle plugin is this using ?

I would assume this is some default behaviour: If there is no Export-Package statement, the plugin (BND actually, IIRC) is exporting all packages not having internal or impl in them. So both packages are exported.

Also it looks like the export version defaults to the bundle version, which is not that good, but better than nothing.

I would assume the bundleversion subpackage should also be exported and thus I would create a package-info.java file there, too. If the package should not be exported, I wonder why it is in that bundle, anyway.

Regards
Felix

Am 03.11.2012 um 01:30 schrieb Ian Boston:

> Hi,
> I almost added a package-info.java below, but stopped.
> 
> @Version("2.2.0")
> package org.apache.sling.commons.osgi;
> 
> import aQute.bnd.annotation.Version;
> 
> and removed the instructions from the pom.xml, until i inspected the
> manifest which went from
> 
> Export-Package: org.apache.sling.commons.osgi;uses:="org.osgi.service.ev
> ent,org.osgi.framework,org.osgi.util.tracker";version="2.2.0"
> 
> to
> 
> Export-Package: org.apache.sling.commons.osgi;uses:="org.osgi.service.ev
> ent,org.osgi.framework,org.osgi.util.tracker";version="2.2.0",org.apach
> e.sling.commons.osgi.bundleversion;uses:="org.osgi.framework";version="
> 2.1.1.SNAPSHOT"
> 
> 
> It seems like switching to  package-info.java caused all child
> packages to be exported with a default version matching the bundle
> version.
> 
> Is that the expected behaviour, and if so, how do you stop it
> happening? The doc on the annotations (or the source code) is not that
> revealing.
> 
> Ian