Jacoco Plugin relies on Jar file name for version information

plugins

(Wolfgang Schmiesing) #1

After switching to Gradle 2.13 my sonar analysis is throwing the following error

    at java_lang_String$substring$3.call(Unknown Source)
    at org.gradle.internal.jacoco.JacocoAgentJar.extractVersion(JacocoAgentJar.groovy:70)
    at org.gradle.internal.jacoco.JacocoAgentJar$_supportsInclNoLocationClasses_closure3.doCall(JacocoAgentJar.groovy:61)
    at org.gradle.internal.jacoco.JacocoAgentJar.supportsInclNoLocationClasses(JacocoAgentJar.groovy:60)
    at org.gradle.internal.jacoco.JacocoAgentJar$supportsInclNoLocationClasses.call(Unknown Source)
    at org.gradle.testing.jacoco.plugins.JacocoTaskExtension.getAsJvmArg(JacocoTaskExtension.groovy:168)
    at org.gradle.testing.jacoco.plugins.JacocoTaskExtension_Decorated.getAsJvmArg(Unknown Source)
    at org.gradle.testing.jacoco.plugins.JacocoTaskExtension_Decorated$getAsJvmArg.call(Unknown Source)
    at org.gradle.testing.jacoco.plugins.JacocoPluginExtension$_applyTo_closure2.doCall(JacocoPluginExtension.groovy:73)
    at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:554)
    at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:535)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)```

It seems that the Jacoco Plugin tries to extract version information from the agent jar file name, see JacocoAgentJar.extractVersion(JacocoAgentJar.groovy:70).
This breaks because my agent jar file name is "jacocoagent.jar" instead of "org.jacoco.agent-0.7.6.201602180812-....jar"

To me it seems brittle to rely on Jar file names for version information. I would suggest to obtain this information from the Jar's manifest instead (e.g. Bundle-Version or similar).

Gradle Version: 2.13
Operating System: Windows 7