[GRADLE-3023] Scala plugin does not work in Java 8 RC Created: 13/Feb/14  Updated: 04/Jun/14  Resolved: 30/May/14

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.0-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Duplicate Votes: 30

Attachments: File scaladoc.patch    

 Description   

The Scala plugin does not work in the latest Java 8 RC (it works fine on Java 7). Scala itself works on Java 8 RC.

java version "1.8.0"
Java(TM) SE Runtime Environment (build 1.8.0-b129)
Java HotSpot(TM) Server VM (build 25.0-b69, mixed mode)

Gradle 1.10

Build time: 2013-12-17 09:28:15 UTC
Build number: none
Revision: 36ced393628875ff15575fa03d16c1349ffe8bb6

Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.8.0 (Oracle Corporation 25.0-b69)
OS: Linux 3.2.0-58-generic-pae i386

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)



 Comments   
Comment by Gradle Forums [ 13/Feb/14 ]

Can you provide the exact error message?

Comment by Gradle Forums [ 13/Feb/14 ]

15:52:06.276 [ERROR] [org.gradle.BuildExceptionReporter]
15:52:06.479 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception.
15:52:06.480 [ERROR] [org.gradle.BuildExceptionReporter]
15:52:06.480 [ERROR] [org.gradle.BuildExceptionReporter] * Where:
15:52:06.480 [ERROR] [org.gradle.BuildExceptionReporter] Build file '/home/mst/Dev/aiq2/build.gradle' line: 29
15:52:06.480 [ERROR] [org.gradle.BuildExceptionReporter]
15:52:06.481 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong:
15:52:06.481 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating root project 'aiq2'.
15:52:06.481 [ERROR] [org.gradle.BuildExceptionReporter] > Could not create task of type 'ScalaDoc'.
15:52:06.484 [ERROR] [org.gradle.BuildExceptionReporter]
15:52:06.485 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
15:52:06.486 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'aiq2'.
15:52:06.486 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:54)
15:52:06.487 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:156)
15:52:06.487 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:38)
15:52:06.487 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:25)
15:52:06.487 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
15:52:06.487 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:55)
15:52:06.488 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:507)
15:52:06.488 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:82)
15:52:06.488 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:31)
15:52:06.488 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:142)
15:52:06.488 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
15:52:06.489 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
15:52:06.489 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
15:52:06.489 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
15:52:06.489 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
15:52:06.489 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
15:52:06.490 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
15:52:06.490 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
15:52:06.490 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
15:52:06.490 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
15:52:06.490 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
15:52:06.490 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
15:52:06.491 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
15:52:06.491 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
15:52:06.491 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
15:52:06.491 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.doAction(Main.java:46)
15:52:06.491 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
15:52:06.492 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.Main.main(Main.java:37)
15:52:06.492 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
15:52:06.492 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
15:52:06.492 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
15:52:06.492 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
15:52:06.492 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
15:52:06.493 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:58)
15:52:06.493 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.tasks.TaskInstantiationException: Could not create task of type 'ScalaDoc'.
15:52:06.493 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:126)
15:52:06.493 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:121)
15:52:06.493 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.AbstractTask.injectIntoNewInstance(AbstractTask.java:148)
15:52:06.493 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskFactory.createTaskObject(TaskFactory.java:121)
15:52:06.494 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskFactory.createTask(TaskFactory.java:81)
15:52:06.494 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory.createTask(AnnotationProcessingTaskFactory.java:99)
15:52:06.494 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.DependencyAutoWireTaskFactory.createTask(DependencyAutoWireTaskFactory.java:39)
15:52:06.494 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:52)
15:52:06.494 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.tasks.DefaultTaskContainer.create(DefaultTaskContainer.java:85)
15:52:06.494 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.TaskContainer$create$0.call(Unknown Source)
15:52:06.495 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.plugins.scala.ScalaPlugin.configureScaladoc(ScalaPlugin.groovy:40)
15:52:06.495 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.plugins.scala.ScalaPlugin.this$2$configureScaladoc(ScalaPlugin.groovy)
15:52:06.495 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.plugins.scala.ScalaPlugin$this$2$configureScaladoc.callCurrent(Unknown Source)
15:52:06.495 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.plugins.scala.ScalaPlugin.apply(ScalaPlugin.groovy:32)
15:52:06.495 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.plugins.scala.ScalaPlugin.apply(ScalaPlugin.groovy)
15:52:06.496 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.DefaultPluginContainer.providePlugin(DefaultPluginContainer.java:104)
15:52:06.496 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.DefaultPluginContainer.addPluginInternal(DefaultPluginContainer.java:68)
15:52:06.496 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:34)
15:52:06.496 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.applyPlugin(DefaultObjectConfigurationAction.java:101)
15:52:06.496 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.access$200(DefaultObjectConfigurationAction.java:32)
15:52:06.497 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction$3.run(DefaultObjectConfigurationAction.java:72)
15:52:06.497 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.plugins.DefaultObjectConfigurationAction.execute(DefaultObjectConfigurationAction.java:114)
15:52:06.497 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractPluginAware.apply(AbstractPluginAware.java:39)
15:52:06.497 [ERROR] [org.gradle.BuildExceptionReporter] at build_pr41h1h6jesckft2o1blb4a40$_run_closure1.doCall(/home/mst/Dev/aiq2/build.gradle:29)
15:52:06.497 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.ClosureBackedAction.execute(ClosureBackedAction.java:58)
15:52:06.497 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:130)
15:52:06.498 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:91)
15:52:06.498 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:903)
15:52:06.498 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:908)
15:52:06.498 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:895)
15:52:06.498 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject$MetaClassAdapter.invokeMethod(BeanDynamicObject.java:246)
15:52:06.499 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:134)
15:52:06.499 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:147)
15:52:06.499 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.java:79)
15:52:06.499 [ERROR] [org.gradle.BuildExceptionReporter] at build_pr41h1h6jesckft2o1blb4a40.run(/home/mst/Dev/aiq2/build.gradle:26)
15:52:06.499 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.groovy.scripts.internal.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:52)
15:52:06.499 [ERROR] [org.gradle.BuildExceptionReporter] ... 33 more
15:52:06.500 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NullPointerException
15:52:06.500 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.DefaultTask.(DefaultTask.java:33)
15:52:06.500 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.ConventionTask.(ConventionTask.java:28)
15:52:06.500 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.SourceTask.(SourceTask.java:36)
15:52:06.500 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.scala.ScalaDoc.(ScalaDoc.java:28)
15:52:06.501 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.tasks.scala.ScalaDoc_Decorated.(Unknown Source)
15:52:06.501 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.DependencyInjectingInstantiator.newInstance(DependencyInjectingInstantiator.java:62)
15:52:06.501 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
15:52:06.501 [ERROR] [org.gradle.BuildExceptionReporter] at org.gradle.api.internal.project.taskfactory.TaskFactory$1.call(TaskFactory.java:124)
15:52:06.501 [ERROR] [org.gradle.BuildExceptionReporter] ... 68 more
15:52:06.501 [ERROR] [org.gradle.BuildExceptionReporter]

Comment by Derek Morr [ 25/Mar/14 ]

I also see this bug on Gradle 1.11 with Java 8 final:

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

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

Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.8.0 (Oracle Corporation 25.0-b70)
OS: Mac OS X 10.9.2 x86_64

Comment by Reidar Sollid [ 26/Apr/14 ]

And in Java 1.8.0_05

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

Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.8.0_05 (Oracle Corporation 25.5-b02)
OS: Linux 3.13.0-24-generic amd64

Comment by Kevin Rands [ 28/Apr/14 ]

Does anyone know if/when this issue will be addressed? It doesn't appear to be getting much love at the moment, but it effectively renders java8/scala development unusable with gradle until it's resolve.

Is there a workaround?

Comment by Adam Murdoch [ 28/Apr/14 ]

Kevin Rands - it should be fixed in the 2.0 release (which will be the next release after 1.12).

Comment by Peter Niederwieser [ 30/May/14 ]

Duplicate of GRADLE-3094.

Comment by Bernie Schelberg [ 31/May/14 ]

For those that can't wait for Gradle 2 for this issue to be resolved, I've created some patched versions here:

https://github.com/10QueensRoad/gradle/releases/download/REL_1.10-java8/gradle-1.10-bin.zip
https://github.com/10QueensRoad/gradle/releases/download/REL_1.12-java8/gradle-1.12-bin.zip

You can download them and use them directly, or change your wrapper configuration to:

build.gradle
task wrapper(type: Wrapper) {
    gradleVersion = '1.12'
    distributionUrl = "https://github.com/10QueensRoad/gradle/releases/download/REL_${gradleVersion}-java8/gradle-${gradleVersion}-bin.zip"
}

I had some issues uploading 1.11, but patched version of 1.10 and 1.12 are there. Sorry, github also refused to accept the *-all.zip files.

If you're using some other version, you can also apply the patch yourself, I've attached it here (scaladoc.patch).

Comment by Bernie Schelberg [ 04/Jun/14 ]

Please note that if you want sourceCompatibility greater than 1.7, you must use incremental compilation for any ScalaCompile tasks. See section 25.10 of the Gradle User Guide for details.

The issue seems to be in the Ant plugin (see scala.tools.ant.Scalac.Target), Scala compilation itself (using Zinc) seems to be working fine.

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