TomDmitriev / gradle-bundle-plugin

Apache License 2.0
47 stars 24 forks source link

Gradle 2.8+/Groovy 2.4.x incompatibility #34

Closed big-guy closed 8 years ago

big-guy commented 8 years ago

We've updated Gradle to use Groovy 2.4.x (https://docs.gradle.org/2.8-rc-1/release-notes#upgraded-to-groovy-2.4.4).

In previous versions of Groovy, when you had multiple setter methods (same name but different parameter types), the method chosen was undefined (it depends on the JVM and order of declaration).

There's a problem here: https://github.com/TomDmitriev/gradle-bundle-plugin/blob/master/src/main/groovy/org/dm/gradle/plugins/bundle/JarBuilder.groovy#L81

The setProperties(Properties) method was chosen most of the time. In 2.4.x, this fails with:

Caused by: groovy.lang.MissingMethodException: No signature of method: aQute.bnd.osgi.Builder.setProperties() is applicable for argument types: (java.util.LinkedHashMap) values: [] Possible solutions: setProperties(java.io.File), setProperties(java.util.Properties), getProperties(), getProperties(), setProperties(java.io.File, java.io.File), addProperties(java.io.File)

The fix is to convert things to the correct type manually (e.g., builder.properties = properties as Properties) or use Properties as the type coming into the method.

Fixing this doesn't cause incompatibilities with older versions of Groovy/Gradle.

TomDmitriev commented 8 years ago

Thanks for spotting the issue! Fixed in v0.6.3.