[GRADLE-1670] OSGi plugin fails with ClassCastException if project.version has type other than String Created: 08/Jul/11  Updated: 04/Jan/13  Resolved: 29/May/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-milestone-3
Fix Version/s: 1.1-rc-1

Type: Bug
Reporter: Peter Niederwieser Assignee: Peter Niederwieser
Resolution: Fixed Votes: 1


Instead of calling project.version.toString(), the plugin casts to String. See: OsgiPluginConvention.java:72

We should also make sure that project.version isn't evaluated in the configuration phase (either by delaying toString() or by using a convention mapping), unless this is already guaranteed.

Comment by Pablo Munoz [ 29/May/12 ]

Peter, We're running into this issue. Do you know when this will be fixed or if there's a workaround?

Comment by Peter Niederwieser [ 29/May/12 ]

Fix will be included in 1.1. As for a workaround, you could explicitly set the manifest version. Be aware that you might run into ordering issues when you set it to project.version.toString() rather than, say, a hardcoded String.

Comment by Pablo Munoz [ 30/May/12 ]

Thanks Peter. Here are comments from Alex Blewitt who is currently working on cbk.

I'm concerned this fix is being pushed out to Gradle 1.1 and not part of 1.0 - can we apply pressure to get it tagged for the 1.0 release candidate, particularly as it's a relatively simple change?

We can't change this in the workaround suggested on the external bug, because whether or not we set the version independently, applying the plugin causes the class cast exception. So no changes that we make can resolve this issue, until this is made available.


Comment by Peter Niederwieser [ 30/May/12 ]

Unfortunately we can't make this part of 1.0 because 1.0 already has code freeze. The good news is that 1.1 will be released shortly (weeks) after 1.0. If you can't wait that long, you may want to use a nightly build.

Have you tried to set project.version before the `osgi` plugin (and possibly after the cbk plugin) gets applied?

Comment by Luke Daley [ 21/Aug/12 ]

This has conflicted with GRADLE-2237 in someway that I don't understand at this moment.

This ticket (GRADLE-1670) really should have been two. One for the CCE and one for the laziness.

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