Search code examples
javascalagradleread-eval-print-loop

gradle REPL in java8 for scala development


Is there a way to retrofit java8 with a REPL in gradle similar to sbt console which automatically adds the classes of the project to the class path of the REPL? https://plugins.gradle.org/plugin/net.java.openjdk.shinyafox.jshell.gradle.plugin only is applicable for java9 or is the workaround of Scala REPL in Gradle considered still best practice?


Solution

  • Following along with http://geekplace.eu/flow/posts/2017-09-28-how-to-add-a-repl.html

    my build.gradle.kts looks like:

    plugins {
        scala
    }
    
    dependencies {
        compile(project(":core"))
        compile(Conf.plugins.ammonite)
    }
    
    tasks{
        "printClasspath"{
            dependsOn("assemble")
            doLast{
                println(java.sourceSets["main"].runtimeClasspath.asPath)
    
            }
        }
    }