Skip to content

Instantly share code, notes, and snippets.

@sethrylan
Last active June 17, 2016 20:08
Show Gist options
  • Save sethrylan/5910482 to your computer and use it in GitHub Desktop.
Save sethrylan/5910482 to your computer and use it in GitHub Desktop.
ScalaBasePlugin scalaConsole/scalaTestConsole tasks
apply plugin: 'scala'
repositories {
mavenCentral()
}
ext {
versions = [
scala: '2.9.2',
scalatest: '2.0.M3',
scalacheck: '1.10.1'
]
}
dependencies {
runtime "org.scala-lang:scala-compiler:$versions.scala"
compile "org.scala-lang:scala-library:$versions.scala"
}
scalaConsole.dependsOn(build)
scalaConsole.dependsOn(test)
scalaConsole.classpath += sourceSets.main.output
scalaTestConsole.classpath += sourceSets.test.output
@copperlight
Copy link

This configuration will produce the following errors in Scala 2.11:

Failed to created JLineReader: java.lang.NoClassDefFoundError: jline/console/completer/Completer
Falling back to SimpleReader.

JLine was unforked from Scala 2.11, so we need to bring in the library manually.

apply plugin: 'scala'

repositories {
    mavenCentral()
}

ext {
    versions = [
        jline: '2.12.1',
        scala: '2.11.6'
    ]
}

dependencies {
    compile "org.scala-lang:scala-library:${versions.scala}"

    runtime "jline:jline:${versions.jline}"
    runtime "org.scala-lang:scala-compiler:${versions.scala}"
}

scalaConsole.dependsOn(build)
scalaConsole.classpath += sourceSets.main.runtimeClasspath

@mikepii
Copy link

mikepii commented Aug 12, 2015

@sethrylan it would be nice to include the above comment's sourceSets.main.runtimeClasspath in the gist for your blog, I'm sure others have hunted for it. Otherwise you can't run parts of your code that have external dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment