ग्राडल प्रोजेक्ट के लिए स्कैला आरईपीएल लॉन्च करने का एक तरीका यहां है: ग्रैडल को क्लासपाथ संकलित और आउटपुट करने दें, और एक शैल स्क्रिप्ट से अलग आरईपीएल लॉन्च करें।
build.gradle
project(':repl') {
def scalaVersion = '2.11.7'
// Require the scala-compiler jar
buildscript {
dependencies {
classpath "org.scala-lang:scala-compiler:${scalaVersion}"
}
repositories {
mavenCentral()
}
}
// The path of the scala-compiler jar
def scalaPath = buildscript.configurations.classpath.find {
it.name == "scala-compiler-${scalaVersion}.jar"
}
// The classpath of this project and its dependencies
def classpath = sourceSets.main.runtimeClasspath.asPath
// Prints the classpath needed to launch the REPL
task printClasspath << {
println "${scalaPath}:${classpath}"
}
}
repl.sh मेरी blog post पर
#!/bin/bash
gradle :repl:compileScala && \
java -Dscala.usejavacp=true \
-classpath "$(gradle :repl:printClasspath --quiet)" \
scala.tools.nsc.MainGenericRunner
अधिक जानकारी।
स्रोत
2015-08-09 08:40:25
हो गया: http://forums.gradle.org/gradle/topics/running_the_scala_repl_from_gradle। त्वरित प्रतिक्रिया के लिए धन्यवाद। –