NullPointerException in ScalaDoc gradle internals using gradle 1.11 and Java 1.8

I’ve hit an NPE in ScalaDoc gradle internals using gradle 1.11 and Java 1.8.

Worked on Java 1.6 and Java 1.7 using gradle 1.8. Any idea what’s gone wrong here?

Stack trace below.

How to reproduce: git clone https://github.com/linkedin/rest.li.git cd rest.li (set JAVA_HOME to java 1.8) (set gradle to 1.11) gradle build --------------------------------------

relevant gradle.build file: https://github.com/linkedin/rest.li/blob/master/restli-int-test-server/build.gradle

------------------------------------------------------------ Gradle 1.11 ------------------------------------------------------------

Build time:

2014-02-11 11:34:39 UTC Build number: none Revision:

a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:

1.8.6 Ant:

Apache Ant™ version 1.9.2 compiled on July 8 2013 Ivy:

2.2.0 JVM:

1.8.0 (Oracle Corporation 25.0-b69) OS:

Linux 2.6.32-358.6.2.el6.x86_64 amd64

---------- stack trace ------------- Caused by: org.gradle.api.tasks.TaskInstantiationException: Could not create task of type ‘ScalaDoc’.

at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:126)

at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:121)

at org.gradle.api.internal.AbstractTask.injectIntoNewInstance(AbstractTask.java:148)

at org.gradle.api.internal.project.taskfactory.TaskFactory.createTaskObject(TaskFactory.java:121)

at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:81)

at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.createTask(AnnotationProcessingTaskFactory.java:99)

at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.createTask(DependencyAutoWireTaskFactory.java:39)

at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:53)

at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:94)

at org.gradle.api.tasks.TaskContainer$create$0.call(Unknown Source)

at org.gradle.api.plugins.scala.ScalaPlugin.configureScaladoc(ScalaPlugin.groovy:40)

at org.gradle.api.plugins.scala.ScalaPlugin.this$2$configureScaladoc(ScalaPlugin.groovy)

at org.gradle.api.plugins.scala.ScalaPlugin$this$2$configureScaladoc.callCurrent(Unknown Source)

at org.gradle.api.plugins.scala.ScalaPlugin.apply(ScalaPlugin.groovy:32)

at org.gradle.api.plugins.scala.ScalaPlugin.apply(ScalaPlugin.groovy)

at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:104)

at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:68)

at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)

at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)

at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:39)

at org.gradle.api.Project$apply.call(Unknown Source)

at org.gradle.api.internal.project.ProjectScript.apply(ProjectScript.groovy:34)

at org.gradle.api.Script$apply.callCurrent(Unknown Source)

at build_39ut1js6ij6nk6lra86b5bqgon.run(/home/jbetz/projects/pegasus_trunk/pegasus/restli-int-test-server/build.gradle:2)

at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)

… 96 more Caused by: java.lang.NullPointerException

at org.gradle.api.DefaultTask.(DefaultTask.java:33)

at org.gradle.api.internal.ConventionTask.(ConventionTask.java:28)

at org.gradle.api.tasks.SourceTask.(SourceTask.java:36)

at org.gradle.api.tasks.scala.ScalaDoc.(ScalaDoc.java:28)

at org.gradle.api.tasks.scala.ScalaDoc_Decorated.(Unknown Source)

at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:62)

at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)

at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:124)

… 123 more

Some additional details:

Works on Java 1.7 with Gradle 1.9-1.11, so may be a combination of scala 2.10 + java 1.8.

I’m getting the same error with java 8 + gradle 2.10.

I also tried the latest nightly gradle 2.0.0 and same error with scalaDoc :frowning:

Well, I found a way to work around the problem if you don’t need the ScalaDoc task (which I don’t).

Replace

‘’’ apply plugin: ‘scala’ ‘’’

with

‘’’ apply plugin: NonBrokenScalaPlugin ‘’’

and add this file to your ‘buildSrc/src/main/groovy/’, and everything else works on java 1.8.

https://gist.github.com/blendmaster/9984974

Thanks Steven, it worked for me.

This is taking too much to be solved… is this the correct way to report bugs for the scala plugin?

This was already fixed in Gradle 2.0 (the first Gradle version to officially support Java 8).