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
26
votes
4 answers
VS Code execute current line or selection to in the integrated console
This old Emacs user, who is used to elpy, is attempting to move onto VSCode with Scala & more specifically Ammonite repl.
I used Ctrl+' to open the integrated terminal & all I have to do is type amm on the bash shell (ubuntu) to open the repl;…

user6273920
- 713
- 1
- 7
- 16
11
votes
1 answer
Is there a way to set the Scala version used in an Ammonite script?
Is there a way to set the Scala version used in an Ammonite script?
I've just started using Ammonite and at first blush it seems far superior to the scalas script runner that I've been using up until now. With scalas, however, I can easily set the…

Douglas
- 2,555
- 3
- 24
- 30
10
votes
4 answers
How to get IntelliJ to recognize imports in Scala script?
I'm having trouble getting IntelliJ to recognize Ammonite imports in my Scala script. This is a new feature, reported here, where there are also instructions. I followed the instructions and I started a new sbt project in IntelliJ to try it out, but…

einnocent
- 3,567
- 4
- 32
- 42
8
votes
2 answers
How to pass Java_opts before an executable to entrypoint in dockerfile?
I am running a scala script with ammonite. I need to pass JAVA_OPTS to limit the memory consumed by ammonite. According to the ammonite docs, I can do it by doing
JAVA_OPTS='-Xmx' amm
Now I want to run this script inside a…

deep
- 1,586
- 1
- 18
- 29
8
votes
2 answers
How do I make intellij Idea to highlight Scala script correctly with #! (shebang)
How do I make intellij Idea to highlight Scala script correctly.
Attempt 1
change filename to 'test.sc' . Intellij does not like the first line i.e it is not valid scala comment syntax
Attempt 2
change filename to 'test.sh' . Intellij thinks all of…

sumnulu
- 3,412
- 1
- 19
- 31
6
votes
1 answer
How to interpret function value wrapped in curly braces (ammonite issue)
After reading What is the formal difference in Scala between braces and parentheses, and when should they be used?, I still don't know how to understand function value wrapped in {}.
Consider the following two REPL sessions:
@ val f = { (x: Int) =>
…

Naitree
- 1,088
- 1
- 14
- 23
3
votes
0 answers
How can I add a GitHub Packages resolver to an Ammonite script?
Does anyone know how I can add a GitHub Packages resolver to an Ammonite script?
I'm quite used to using GitHub Packages with sbt, but we use the sbt-github-packages plugin, which makes it very easy to add a GitHub Packages resolver to a build.sbt…

Douglas
- 2,555
- 3
- 24
- 30
3
votes
2 answers
object circe is not a member of package io
I am trying to create a predef.sc file for ammonite REPL. This is what I have written
val fs2Version = "2.2.2"
val circeVersion = "0.13.0"
// fs2
interp.load.ivy("co.fs2" %% "fs2-core" % fs2Version)
import scala.collection.immutable.{Stream =>…

Knows Not Much
- 30,395
- 60
- 197
- 373
3
votes
3 answers
Import $ivy in Ammonite
I need to import sikulixapi in an Ammonite script. I could be able to do so.
So if I do from the interactive console of Ammonite this:
@ import $ivy.`com.sikulix:sikulixapi:1.1.0`…

david.perez
- 6,090
- 4
- 34
- 57
2
votes
1 answer
Jupyter Notebook with Almond Scala Kernel Runs into Error
Is there a way to identify which library version should I be using for a specific scala version? For example., I want to use commons-lang3 library but whatever version I choose I run into an error.
I'm using the Almond notebook and here is the…

joesan
- 13,963
- 27
- 95
- 232
2
votes
0 answers
Emacs ammonite-mode
Is there a half-decent Emacs mode for Ammonite scripts somewhere? When I try to use scala-mode it doesn't work that well. Errors on most every line.

john sullivan
- 1,898
- 2
- 13
- 21
2
votes
1 answer
Re-import a script in Ammonite (scala)
I can import a script's methods/variables in Ammonite using import $file.MyScript, MyScript._. It works well the first time but what if I wish to import an updated version of MyScript.sc?
Documentation suggests to do
@ repl.sess.load()
Which…

mchl_k
- 314
- 1
- 10
2
votes
1 answer
value YpartialUnification is not a member of scala.tools.nsc.Settings
I'm trying to run scala cats in REPL. Following cat's instructions I have installed ammonite REPL and put following imports in predef.sc
nterp.configureCompiler(_.settings.YpartialUnification.value = true)
import…

Mengo
- 1,177
- 1
- 10
- 25
2
votes
1 answer
Cannot Resolve Ammonite Main Methods in Intellij
I want to use @main like described here: https://ammonite.io/#ScriptArguments
@main
def all() = {
...
}
It cannot be resolved in Intellij. I couldn't find an import. I have added these dependencies:
libraryDependencies ++= Seq(
…

pme
- 14,156
- 3
- 52
- 95
2
votes
1 answer
How to change Ammonite, coursier cache location?
I am using Coursier in ammonite to download jar from a private repo. However for reason of integration with Intellij, I would like to change the location that coursier uses to cache the artificat. I would like to point to my local ivy. Is there a…

MaatDeamon
- 9,532
- 9
- 60
- 127