Comments (16)
It's just a warning, you should be able to use the console (although without tab completion).
I'll leave this open, as we can probably find a system property to set to avoid trying JLine in the first place.
from idea-sbt-plugin.
Yes, it does seem to work following the warning. Thanks for replying so quickly.
Mike
from idea-sbt-plugin.
I will demo SBT running from IDEA at Googleplex Wednesday April 18 in front of 300+ people. It would be great to not have to explain away this big bad stack dump. Is there a solution?
from idea-sbt-plugin.
> eval System.setProperty("jline.terminal" , "")
[info] ans: java.lang.String = jline.UnsupportedTerminal
> console
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_29).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
You can run this in your build definition to hide it a better.
import sbt._
import Keys._
object build extends Build {
// for the scala REPL
System.setProperty("jline.terminal" , "")
...
}
from idea-sbt-plugin.
My project has a build.sbt file. I created a project/build.scala file and put the code you suggested in it.
$ sbt update gen-idea
[info] Loading global plugins from C:\Users\Mike Slinn\.sbt\plugins
[info] Loading project definition from E:\work\books\akkafutures\akkaFutures\project
[error] No projects defined in build unit E:\work\books\akkafutures\akkaFutures
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
from idea-sbt-plugin.
In that case, add this to build.sbt
instead:
{System.setProperty("foo", "bar"); seq()} // for the Scala REPL JLine, runs just after SBT JLine initialization.
from idea-sbt-plugin.
No better. Perhaps I did it wrong? Here is the complete build.sbt
// see https://github.com/sbt/sbt-assembly
import AssemblyKeys._ // put this at the top of the file
organization := "Micronautics Research"
name := "AkkaFutures"
version := "0.1"
scalaVersion := "2.9.1-1"
scalaVersion in update := "2.9.1"
autoCompilerPlugins := true
addCompilerPlugin("org.scala-lang.plugins" % "continuations" % "2.9.1")
scalacOptions ++= Seq("-deprecation") //, "-P:continuations:enable")
scalacOptions in (Compile, console) += "-Yrepl-sync"
scalacOptions in (Compile, doc) <++= baseDirectory.map {
(bd: File) => Seq[String](
"-sourcepath", bd.getAbsolutePath,
"-doc-source-url", "https://bitbucket.org/mslinn/akkafutures/src/9fa9548ce587/akkaFutures€{FILE_PATH}.scala"
)
}
fork in run := true
// Use -Xbatch for benchmarks
javaOptions in run += "-server -Xmx1G -Xms1G"
resolvers ++= Seq(
"Akka Snapshots" at "http://akka.io/snapshots",
"Typesafe Snapshots" at "http://repo.typesafe.com/typesafe/snapshots",
"Typesafe Releases" at "http://repo.typesafe.com/typesafe/releases",
"Scala-Tools Snapshots" at "http://scala-tools.org/repo-snapshots",
"Scala Tools Releases" at "http://scala-tools.org/repo-releases"
)
libraryDependencies <+= scalaVersion { v => compilerPlugin("org.scala-lang.plugins" % "continuations" % v) }
libraryDependencies ++= Seq(
"org.scalatest" % "scalatest_2.9.1" % "1.7.1" % "test" withSources(),
"com.typesafe.akka" % "akka-actor" % "2.0" withSources(),
"com.github.scala-incubator.io" % "scala-io-core_2.9.1" % "0.3.0" withSources(),
"com.github.scala-incubator.io" % "scala-io-file_2.9.1" % "0.3.0" withSources(),
"org.apache.httpcomponents" % "httpclient" % "4.1.2" withSources(),
"org.scala-tools" % "scala-stm_2.9.1" % "0.5" withSources()
)
seq(assemblySettings: _*)
logLevel := Level.Error
// Optional settings from https://github.com/harrah/xsbt/wiki/Quick-Configuration-Examples follow
{System.setProperty("jline.terminal", "jline.UnsupportedTerminal"); seq()} // for the Scala REPL JLine, runs just after SBT JLine initialization.
// define the statements initially evaluated when entering 'console', 'console-quick', or 'console-project'
initialCommands := """
import akka.dispatch._
import akka.util.Duration
import akka.util.duration._
import com.micronautics.akka.dispatch.futureScala._
import com.micronautics.concurrent._
import com.micronautics.util._
import java.net.URL
import java.util.concurrent.Executors
import scala.MatchError
import scala.util.Random
import scalax.io.JavaConverters.asInputConverter
import scalax.io.Codec
//
val random = new Random()
//
val executorService = Executors.newCachedThreadPool()
implicit val context = ExecutionContext.fromExecutor(executorService)
//
val daemonExecutorService = DaemonExecutors.newFixedThreadPool(10)
//implicit val daemonContext = ExecutionContext.fromExecutor(daemonExecutorService)
//
def expensiveCalc(x:Int) = { x * x }
//
def expCalc(a:Int, b:Int) = {
Thread.sleep(random.nextInt(200))
a + b
}
//
def httpGet(urlStr:String):String =
new URL(urlStr).asInput.slurpString(Codec.UTF8)
//
//val f = Future { httpGet("http://akka.io") }
//
val urlStrs = List (
"http://akka.io",
"http://www.playframework.org",
"http://nbronson.github.com/scala-stm"
)
"""
// Only show warnings and errors on the screen for compilations.
// This applies to both test:compile and compile and is Info by default
logLevel in compile := Level.Warn
from idea-sbt-plugin.
Sorry, it should be:
{System.setProperty("jline.terminal", ""); seq()} // for the Scala REPL JLine, runs just after SBT JLine initialization.
from idea-sbt-plugin.
Hot diggety-dawg! It works!
from idea-sbt-plugin.
Not so fast. After the initialCommands run, and I type in an expression, no further output is generated from the sbt console
from idea-sbt-plugin.
post a transcript please...
from idea-sbt-plugin.
[info] Loading global plugins from C:\Users\Mike Slinn\.sbt\plugins
[info] Loading project definition from E:\work\books\akkafutures\akkaFutures\project
[info] Set current project to AkkaFutures (in build file:/E:/work/books/akkafutures/akkaFutures/)
> console
import akka.dispatch._
import akka.util.Duration
import akka.util.duration._
import com.micronautics.akka.dispatch.futureScala._
import com.micronautics.concurrent._
import com.micronautics.util._
import java.net.URL
import java.util.concurrent.Executors
import scala.MatchError
import scala.util.Random
import scalax.io.JavaConverters.asInputConverter
import scalax.io.Codec
random: scala.util.Random = scala.util.Random@10cb191
executorService: java.util.concurrent.ExecutorService = java.util.concurrent.ThreadPoolExecutor@5dae4f
context: akka.dispatch.ExecutionContext with java.util.concurrent.Executor = akka.dispatch.ExecutionContext$WrappedExecutor@5ec9da
daemonExecutorService: java.util.concurrent.ExecutorService = com.micronautics.concurrent.DaemonExecutors$DaemonThreadPoolExecutor@11...Welcome to Scala version 2.9.1-1 (Java HotSpot(TM) Client VM, Java 1.6.0_31).
Type in expressions to have them evaluated.
Type :help for more information.
scala> 1+2
Nothing further prints
from idea-sbt-plugin.
I'm guessing this workaround doesn't work on Windows. Setting that property to ""
triggers automatic detection of the terminal. [1]
Instead, you can explicitly set it to use "no terminal":
{System.setProperty("jline.terminal" , "none"); seq()} // for the Scala REPL.
from idea-sbt-plugin.
OK, that did the job. Many thanks!
from idea-sbt-plugin.
Sorry about the hassle, SBT and scalac have a pretty intimate relationship, but they don't always agree on such matters...
from idea-sbt-plugin.
Closing this issue; the workaround above is available for now; when SBT and the REPL move to a common JLine we can avoid this altogether.
from idea-sbt-plugin.
Related Issues (20)
- Assertion Error
- REQUEST: add more details to readme.md
- Custom path for test sources in special task
- ERROR: Editor of class com.intellij.openapi.editor.impl.EditorImpl hasn't been released HOT 2
- Compatibility with Idea-15 HOT 33
- SBT console not showing up in Tools or View-Tool Windows
- Improvement: Allow key binding for 'Refresh ALL sbt projects' command HOT 1
- ANDROID_HOME??? HOT 3
- SBT console arrows up or down don't show history HOT 1
- can't find scala 2.11.8
- com.github.mpeltonen#sbt-idea;1.7.0-SNAPSHOT: not found
- Doesn't work in Idea-2017 EAP (idea-IU-171.2014.21) HOT 1
- Version for jar not set properly when changed in build.sbt HOT 1
- SBT sync imports libraries as modules for Android project with Google Mobile Services
- Exception in plugin sbt idea when using run configuration for Android
- IllegalStateException HOT 4
- Exception in plugin SBT(1.8.0) when is not used HOT 2
- IllegalArgumentException
- Exception in plugin sbt HOT 1
- Support command line arguments (in addition to JVM parameters)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from idea-sbt-plugin.