Ammonite enhances the Scala REPL and Scala scripts. It also allows Scala to be used as an interactive bash replacement.
Questions tagged [ammonite]
67 questions
2
votes
1 answer
How to make Intellij resolve package from private maven repository in ammonite script?
IDE support of ammonite works as described in this post https://blog.jetbrains.com/scala/2018/05/07/ammonite-support/.
Ammonite use private maven repository also works in script as described in the link http://ammonite.io/#import$ivy
the only…

Dyno Fu
- 8,753
- 4
- 39
- 64
2
votes
3 answers
How do you use a local maven repo with Ammonite?
I'm using ammonite (http://ammonite.io/) to write Scala scripts. It allows you to fetch remote dependencies via this kind of text:
import $ivy.`org.scalaz::scalaz-core:7.2.7`, scalaz._, Scalaz._
How do you use a local maven repo (sitting in e.g.…

Mohan
- 7,302
- 5
- 32
- 55
2
votes
1 answer
Ammonite classpath clashes with Github4s (java.lang.AbstractMethodError)
I’m writing an ammonite script to work with Github4s library to access the github api and have a issue, probably with the classpath. The simple version of the script is as follows:
import $ivy.`com.47deg::github4s:0.17.0`, github4s.Github,…

makados
- 149
- 1
- 3
- 11
2
votes
1 answer
How can I make scala's ammonite use scala.util instead of ammonite.util as default for util?
In the "official" scala REPL I can do
scala> import util.Random
scala> util.Random.nextInt
res0: Int => -306696783
but in Ammonite-REPL I get
@ import util.Random
cmd3.sc:1: object Random is not a member of pack ammonite.util
import util.Random
…

RubenLaguna
- 21,435
- 13
- 113
- 151
2
votes
2 answers
How to issue a command that produces infinite output and return immediately
When I write the following code (in ammonite but i don't think it matters)
("tail -f toTail.txt" lineStream) foreach(println(_)), the program give me the last line as intend but then hang, and even if i write more in the file, nothing come out.
How…

MaatDeamon
- 9,532
- 9
- 60
- 127
2
votes
2 answers
SSH command from within a Scala program with pure Scala API or Ammonite API
I would like to perform an SSH command and then execute some command on a distant machine from within scala. Both the scala API and Scala Ammonite provide way to execute system command. However I am having problem with ssh. How do i run an ssh…

MaatDeamon
- 9,532
- 9
- 60
- 127
2
votes
1 answer
package cats contains object and package with same name: implicits
Heard about the new Cats-Effect library here
http://typelevel.org/blog/2017/05/02/io-monad-for-cats.html
Immidiately added the following line to my ammonite shell predef.sc
interp.load.ivy("org.typelevel" % "cats-core_2.12" %…

Knows Not Much
- 30,395
- 60
- 197
- 373
2
votes
1 answer
How to reuse Ammonite REPL's sc files in a sbt project?
I have some reusable Ammonite REPL's sc files that were used in some Jupyter Scala notebooks.
Now I am creating a standalone application built from sbt. I hope I can reuse these existing sc files in the sbt project.
Is it possible to share these sc…

Yang Bo
- 3,586
- 3
- 22
- 35
2
votes
4 answers
How to debug an Ammonite script?
Normally my scripts are simple and can be debugged by tracing with prints
But can I use a real debugger?
Maybe launching the JVM with remote debugging enabled, but I don't know how to do it.

david.perez
- 6,090
- 4
- 34
- 57
2
votes
2 answers
Why do scala REPL and Ammonite behave differently in this point and which behaviour is correct?
The Scala expression
.3.+(5)
evaluates to 5.3 as a result in Ammonite-REPL, as I expected. In the Scala REPL, though, it yields a syntax error, printing
scala> .3.+(5)
:1: error: ';' expected but double literal found.
$intp.3.+(5)
…

spilot
- 625
- 1
- 7
- 20
2
votes
1 answer
Spark unable to find "spark-version-info.properties" when run from ammonite script
I have an ammonite script which creates a spark context:
#!/usr/local/bin/amm
import ammonite.ops._
import $ivy.`org.apache.spark:spark-core_2.11:2.0.1`
import org.apache.spark.{SparkConf, SparkContext}
@main
def main(): Unit = {
val sc = new…

rmin
- 1,018
- 1
- 9
- 18
2
votes
1 answer
Ammonite scripts - load/execute script relative to root or user home
I'm trying to minimize the amount of boilerplate that I have to write in an ammonite script. It seems like predef.sc is not loaded by default (which is good) but I'd like to have different sets of predefs for different files, and simply write a line…

Jacob Wang
- 4,411
- 5
- 29
- 43
1
vote
1 answer
How do I specify the java version to use with the Ammonite Scala shell on Windows?
I am working on an enterprise system where I can't control my system Path environment variable, and the system path points to a version of Java that is currently broken. I have another version of Java installed, and I would like to use that to run…

Liam Bohl
- 21
- 3
1
vote
1 answer
Ammonite: Script ... does not take arguments (under OS X)
Using ammonite, I am trying to run a script that takes command line arguments. I just can't figure out what I am doing wrong. It works under Linux with a different version of ammonite, but not under OS X using homebrew:
According to the…

dmg
- 4,231
- 1
- 18
- 24
1
vote
0 answers
java.lang.ClassCastException when deserializing Scala object
So I have an object like this
case class QueryResult(events: List[Event])
that I need to serialize deserialize. For serialization I have this implicit class
implicit class Serializer(obj: Object) {
def serialize: Array[Byte] = {
val…

mdornfe1
- 1,982
- 1
- 24
- 42