bintray / gradle-bintray-plugin

Apache License 2.0
1.28k stars 194 forks source link

Nullpointer exception when used with Gradle 2.4+ #83

Open ZacSweers opened 9 years ago

ZacSweers commented 9 years ago
java.lang.NullPointerException
        at org.gradle.api.internal.tasks.DefaultTaskDependency.add(DefaultTaskDependency.java:109)
        at org.gradle.api.internal.AbstractTask$11.run(AbstractTask.java:323)
        at org.gradle.api.internal.tasks.TaskMutator.mutate(TaskMutator.java:37)
        at org.gradle.api.internal.AbstractTask.dependsOn(AbstractTask.java:321)
        at com.jfrog.bintray.gradle.BintrayPlugin$_apply_closure2_closure5.doCall(BintrayPlugin.groovy:96)
        at com.jfrog.bintray.gradle.BintrayPlugin$_apply_closure2.doCall(BintrayPlugin.groovy:88)
eyalbe4 commented 9 years ago

Please make sure you're using the latest Gradle Bintray Plugin version: https://bintray.com/jfrog/jfrog-jars/gradle-bintray-plugin/view https://plugins.gradle.org/plugin/com.jfrog.bintray

ZacSweers commented 9 years ago

I am using the latest version.

The problem is here: https://github.com/bintray/gradle-bintray-plugin/blob/master/src%2Fmain%2Fgroovy%2Fcom%2Fjfrog%2Fbintray%2Fgradle%2FBintrayPlugin.groovy#L93-L95

Either the taskName variable is null, or the AbstractTask that's created in dependsOn is null (presumably because that path can't be found).

ZacSweers commented 9 years ago

When I attach the debugger, I only see a task for publishToMavenLocal and not the publish<publication>ToMavenLocal task that it looks for.

ZacSweers commented 9 years ago

@eyalbe4 any plans to look into this?

eyalbe4 commented 9 years ago

Here's something that may help you troubleshoot the issue: Please try building the "publications-example" example available here: https://github.com/bintray/bintray-examples/tree/master/gradle-bintray-plugin-examples Just configure your Bintray details in the "bintray" closure and run>gradle build buintrayUpload. In the example, you'll see a publication named "MyPublication". Here's the output I got when building this example using gradle 2.4. Notice below the "publishMyPublicationPublicationToMavenLocal" task, which the "bintrayUpload" task dependes on. Hope this helps.

...publications-example>gradle build bintrayUpload :compileJava UP-TO-DATE :processResources UP-TO-DATE :classes UP-TO-DATE :jar UP-TO-DATE :assemble UP-TO-DATE :compileTestJava UP-TO-DATE :processTestResources UP-TO-DATE :testClasses UP-TO-DATE :test UP-TO-DATE :check UP-TO-DATE :build UP-TO-DATE :generatePomFileForMyPublicationPublication :publishMyPublicationPublicationToMavenLocal :bintrayUpload

BUILD SUCCESSFUL

Total time: 12.092 secs

ZacSweers commented 9 years ago

What am I supposed to take away from that? One working example doesn't mean there isn't a bug elsewhere. I can point you to a nonworking example in https://github.com/novoda/bintray-release. Try running the tests with any version of gradle 2.4+. You are far more likely to recognize what's going wrong in that than I would be trying to compare what works in your sample.