On 25 Jan 2012, at 10:31, Thomas GILLET wrote:

> Hello,
> 
> I'm using the maven-bundle-plugin to develop a bundle containing a package
> which is exported AND imported (i.e it is a public package which is used by
> private code, so BND adds the import statement in the manifest as it is
> considered a good practice).
> 
> I'm not using package versioning, so, from my understanding of the BND
> documentation, the export statement should use the bundle version, and the
> import statement should use the version from the export statement. It was
> all working fine until I run a "mvn clean" before my "mvn package" and end
> up with no version on my import statement.
> 
> My guess was that after a clean there is no manifest file, so there is no
> export statement to get the package version from.
> As a workaround I added the "bundle:manifest" goal just before the
> "bundle:bundle" goal so the manifest is generated a first time before the
> bundle creation. It's now working fine.

The behaviour for the "bundle:bundle" goal follows bnd by not using any version 
for exported packages unless you supply a version, either in the configuration 
or via packageinfo.

The legacy behaviour for "bundle:manifest", when creating a manifest for an 
existing/attached artifact, is to use the bundle version as the exported 
package version (see the PackageVersionAnalyzer).
You can make the "bundle:manifest" goal behave more like "bundle:bundle" by 
setting <rebuildBundle>true</rebuildBundle> in the bundle <configuration> 
section, ie. outside of the bnd <instructions>.

The reason for this inconsistency is because these goals were originally 
developed by different people, and changing the legacy manifest behaviour now 
will break old builds - hence the new flag to switch the behaviour: 
https://issues.apache.org/jira/browse/FELIX-3206. Also the bug where the 
"bundle:bundle" goal could pick up an existing manifest from the target 
directory and merge its headers into the final result (which is why you see the 
different results using "bundle:manifest" followed by "bundle:bundle" without a 
clean) is fixed in 2.3.6.

Personally, I recommend explicitly setting the versions of exported packages 
rather than rely on defaults.

> But I wonder if this is "normal" behavior or not. Did I do something wrong ?
> Is it a bug ? Should I add an issue about that in the Felix Jira ?
> 
> Not a very big problem but, if someone knows something about it, I would
> like to understand.
> 
> Thomas GILLET
> -- 
> View this message in context: 
> http://old.nabble.com/maven-bundle-plugin-%3A-no-import-version-for-packages-being-both-imported-and-exported-after-a-clean-build-tp33200339p33200339.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to