[GRADLE-3093] Enable to setup a simple scala build Created: 27/May/14  Updated: 05/Aug/14  Resolved: 05/Aug/14

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

Type: Task
Reporter: Gradle Forums Assignee: Unassigned
Resolution: Fixed Votes: 0


 Description   

Hi,

I'm using sala 1.10 and I'm unable to setup a scala build thanks to the scala plugin.
The line apply plugin: 'scala' generates an exception : Could not create task of type 'ScalaDoc'

I'm a newbie with gradle. Can someone help me ?

Thanks



 Comments   
Comment by Gradle Forums [ 27/May/14 ]

Can you provide a reproducible example? Meanwhile, you can study the Scala chapter in the [Gradle User Guide]([1]http://gradle.org/docs/current/usergu...), check out the Scala sample builds in the full Gradle distribution, or use `gradle init --type scala-library` to create a working skeleton for a Scala build.
----------------------------------------------------------------------------------------
[1] http://gradle.org/docs/current/userguide/userguide_single.html

Comment by Gradle Forums [ 27/May/14 ]

Same error when I run :

$ gradle init --type scala-library
$ gradle

Please see the stacktrace in the [gist]([1]https://gist.github.com/pjean/8469878)
----------------------------------------------------------------------------------------
[1] https://gist.github.com/pjean/8469878

Comment by Gradle Forums [ 27/May/14 ]

I can't reproduce this, and I wonder if it's at all related to Gradle's Scala support. (Can you verify this?) My best guess is that your JDK installation isn't clean (e.g. you have some libs in `jre/lib`) or your Gradle installation is corrupted. Can you show the output of `gradle -v`?

Comment by Gradle Forums [ 27/May/14 ]

------------------------------------------------------------
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-ea (Oracle Corporation 25.0-b60)
OS: Mac OS X 10.9.1 x86_64

Comment by Gradle Forums [ 27/May/14 ]

Perhaps your Scala version isn't compatible with Java 1.8 (I'm not sure if any released Scala version is). Can you try if running Gradle with JDK 1.7 solves the problem?

If this also happens when using, say, the Java plugin, rather than the Scala plugin, then it might be a problem with Gradle and Java 8, and a reproducible example would be appreciated.

Comment by Gradle Forums [ 27/May/14 ]

I set up my JAVA_HOME to use 1.7 and it works fine.

Thanks for your help

UPDATE : Gradle and Java plugin works fine with Java 8

Comment by Gradle Forums [ 27/May/14 ]

This may be a bug in Java 8. getPropertyType() allows for returning null and it is called in the parameter list of isAssignableFrom(), which does not allow for nulls. Relevent code:

if (isAssignable(gpd.getPropertyType() /* Can return null /, pd.getPropertyType() / Can return null */)) {
...
private static boolean isAssignable(Class<?> current, Class<?> candidate) {
return current == null ? candidate == null : current.isAssignableFrom(/* Can't be null */candidate);
}

Relevent breaking patch to the JDK: [1]http://hg.openjdk.java.net/hsx/hotspo...
----------------------------------------------------------------------------------------
[1] http://hg.openjdk.java.net/hsx/hotspot-rt/jdk/rev/29f979efbabf

Comment by Gradle Forums [ 27/May/14 ]

------------------------------------------------------------
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.7.0_45 (Oracle Corporation 24.45-b08)
OS: Mac OS X 10.9.1 x86_64

Comment by Gradle Forums [ 27/May/14 ]

generates an exception : Could not create task of type 'ScalaDoc'

Comment by Gradle Forums [ 27/May/14 ]

bug in Gradle

Comment by Gradle Forums [ 27/May/14 ]

I get the same error with Gradle 1.10 and the latest Java 8 RC. I don't get the error with Java 7. And I don't have any issues with running Scala itself on Java 8 RC.

So it seems like Gradle 1.10 (or the Scala plugin of Gradle 1.10) is incompatible with the latest 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)

Comment by Gradle Forums [ 27/May/14 ]

goodbye gradle...

Comment by Gradle Forums [ 27/May/14 ]

Well I had to downgrade to Java 7. Basically my fault to use a beta software but I hope gradle to fix this shortly.

Comment by Gradle Forums [ 27/May/14 ]

I have the same issue with java version "1.8.0_05", scala-2.10.3 and gradle-1.11

Comment by Gradle Forums [ 27/May/14 ]

Issue is still there, gradle-1.12, scala 2.10.4, jdk 1.8.0_05

Comment by Gradle Forums [ 27/May/14 ]

Try with 2.0 nightly. 2.0 will be the first Gradle version that officially supports to be run with Java 8.

Comment by Gradle Forums [ 27/May/14 ]

Just tried both 2.0 and 2.1 snapshots (gradle-2.0-20140515233139+0000 and gradle-2.1-20140526220021+0000) - neither worked.

Comment by Gradle Forums [ 27/May/14 ]

Thanks. We'll try to fix it for 2.0.

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