Fixing Gradle Error: Cannot infer Scala class path because no Scala library Jar was found on class path: configuration ‘:compile’

When you get this error:

Cannot infer Scala class path because no Scala library Jar was found on class path: configuration ':compile'

This indicates that you need to tell gradle which version of Scala you’re interested in, so that it can download it.

To fix this, add the following to build.gradle:

dependencies {
    compile 'org.scala-lang:scala-library:2.10.1'
}

Interested in Scala? I send out weekly, personalized emails with articles and conference talks. Click here to see an example and subscribe.

1 reply
  1. mogli
    mogli says:

    This is exactly, that i was looking for.
    Is there any way to tell gradle and idea to use local scala library(Scala SDK) rather then downloading from maven repository.

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *