2012-03-31 19 views
5

क्या एक ग्रेडल कार्य से स्कैला आरईपीएल का आह्वान करने का एक मानक तरीका है? क्या इसके लिए कोई प्लगइन है? मुझे एक नहीं मिला है। मैं इस उदाहरण का अनुसरण कर सकता है, लेकिन यह तिथि कम लगता है और मैं एक बेहतर तरीका है अगर जानना चाहता था:ग्रेडल से स्केल आरईपीएल चलाना?

http://gradle.1045684.n5.nabble.com/Reading-keyboard-input-td3073108.html

धन्यवाद।

उत्तर

6

ग्रैडल के साथ बंडल किए गए स्कैला प्लगइन में इस समय आरईपीएल समर्थन नहीं है। हालांकि यह जल्द ही बदल सकता है क्योंकि हम वर्तमान में हमारे स्कैला समर्थन में सुधार करने के लिए निवेश कर रहे हैं। http://forums.gradle.org पर अपनी इच्छाओं के बारे में हमें बताएं।

+0

हो गया: http://forums.gradle.org/gradle/topics/running_the_scala_repl_from_gradle। त्वरित प्रतिक्रिया के लिए धन्यवाद। –

2

ग्राडल प्रोजेक्ट के लिए स्कैला आरईपीएल लॉन्च करने का एक तरीका यहां है: ग्रैडल को क्लासपाथ संकलित और आउटपुट करने दें, और एक शैल स्क्रिप्ट से अलग आरईपीएल लॉन्च करें।

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 

अधिक जानकारी।

संबंधित मुद्दे