[GRADLE-1306] Can't specify custom properties to bnd analyzer when creating OSGi bundles Created: 15/Jan/11  Updated: 16/Jan/17  Resolved: 16/Jan/17

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: None

Type: Improvement
Reporter: John Gibson Assignee: Unassigned
Resolution: Fixed Votes: 0


There is no way to specify custom properties to the bnd analyzer when creating OSGi bundles. Currently the OSGi plugin only allows the user to specify the following analyzer properties via simple getters and setters on an o.g.api.internal.plugins.OsgiManifest: bundle version, bundle symbolic name, bundle name, bundle description, bundle license, bundle vendor, and bundle documentation URL. There are at least a few other useful ones, -versionpolicy, -versionpolicy-impl, and -versionpolicy-uses as described here: http://www.aqute.biz/Code/XBnd
There should be a way to specify these and any other useful analyzer properties.

Comment by John Gibson [ 15/Jan/11 ]

I've written a patch that addresses this that is available here: https://github.com/jgibson/gradle/tree/GRADLE-1306

It adds a Map<String,String> properties property to o.g.api.plugins.osgi.OsgiManifest. These properties are passed directly onto the Analyzer. Note that these new properties supersede the simple properties set on OsgiManifest (setVersion(), setName(), etc.). I'm not sure if this behavior is desirable because several of the simple properties have default values, so a user who tries to configure the bundle entirely with a nested properties map will have unexpected behavior. For example in a project named foo:

jar {
manifest {

{ 'Bundle-Name':'My custom name' }


Will yield a manifest with the Bundle-Name header set to 'foo', even though 'My custom name' seems more appropriate.
You'd need to the following to get the desired result:
jar {
manifest {
name = null

{ 'Bundle-Name':'My custom name' }


I'm not familiar enough with other Gradle plugins to know which approach is a better fit with the other plugins. Are there other examples of a generic properties map conflicting with ease-of-use properties?

Right now it lacks a unit test, I'll see if I can get one written soon.

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by John Gibson [ 19/Nov/16 ]

I think that this was fixed independently not too long after I filed the bug:

So we can probably close this as fixed at version 1.0-milestone-2.

Generated at Wed Jun 30 11:52:12 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.