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
0
votes
1 answer
How to iterate all mill targets in build.sc, how to get target.dest from outside the target?
I would like to write a mill utility tool (maybe a function or Module inside build.sc) for summarizing and post processing results of various targets. Instead of hard coding all processed targets I prefer a solution that could somehow iterate the…

user4955663
- 1,039
- 2
- 13
- 21
0
votes
1 answer
Ammonite Ivy Import Fails For Joda Time
I have the following in my predef.sc file and when I load Ammonite via my terminal, it fails for one library, the joda-time:
import $ivy.`org.typelevel::cats-core:2.1.1`, cats._, cats.implicits._
import…

joesan
- 13,963
- 27
- 95
- 232
0
votes
1 answer
mill: Failed resolvedAmmoniteReplIvyDeps
I have following very simple module definition in build.src
import mill._
import mill.bsp.BSP.millSourcePath
import mill.scalalib.{JavaModule, ScalaModule}
object scalaMod0 extends ScalaModule {
override def scalaVersion = "2.13.6"
}
Mill…

user4955663
- 1,039
- 2
- 13
- 21
0
votes
1 answer
Is there any way to install Scala Ammonite-REPL in Windows 8.1
I'm looking for how to install Scala Ammonite-REPL in Windows 8.1 but I didn't find anything in the web.
does anyone know something related about this?
Is there any way to do this?

Chema
- 2,748
- 2
- 13
- 24
0
votes
1 answer
How to interact with my play application in console?
I have a play 2.8.x application that uses scala.
The sbt project has a play web project and another library module.
Is it possible to interact with the other module in a REPL?
I have ammonite installed on my system also, but not sure how to load my…

Blankman
- 259,732
- 324
- 769
- 1,199
0
votes
1 answer
How to tell whether i am running under Ammonite repl or in a script?
I was trying to use different builders to build the SparkSession and AmmoniteSparkSession requires repl.
This won't work, i think it is because repl is a compile time error.
val sparkSessionBuilder =
try {
repl
…

Dyno Fu
- 8,753
- 4
- 39
- 64
0
votes
3 answers
Ammonite: how to use another script from an Ivy dependency?
I have an Ammonite Script that I want to deliver in a JAR.
In another project I want to use this Script - but so far with no success.
I tried according to the documentation (sol_local_build.sc):
import $ivy.`mycompany:myproject_2.12:2.1.0-SNAPSHOT`,…

pme
- 14,156
- 3
- 52
- 95
0
votes
0 answers
How to run 'set' or 'source' with Ammonite Script
I want to do the following with Ammonite:
set -a
source .my-env
docker-compose up -d
My Solution looks like:
%("set", "-a")
%("source", "./devops/it.env")
%("docker-compose", ...)
The first 2 lines do not work, I get No such file or…

pme
- 14,156
- 3
- 52
- 95
0
votes
1 answer
How to add parameters to run SBT in Ammonite?
I want to run this SBT command in Ammonite:
sbt -mem 3000 clean compile docker:publishLocal
I tried a few things like:
%.sbt("-mem 3000", 'clean, 'test)(pwd)
Which gives this exception:
[error] Expected symbol
[error] Not a valid command:…

pme
- 14,156
- 3
- 52
- 95
0
votes
3 answers
How to pin the version of a SNAPSHOT dependency in an Ammonite script
Ammonite can download dependencies from Maven repositories.
I'm using a SNAPSHOT dependency, and I'd like to use always the cached version, in order to avoid using possible untested newer versions. Is this possible?
I know that Ammonite uses lately…

david.perez
- 6,090
- 4
- 34
- 57
0
votes
1 answer
Unable to stop and rm docker containers from Scala script
I am trying to execute the following command from within an ammonite Scala script:
Process("docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)")
I always get the following output:
unknown shorthand flag: 'a' in -a
See 'docker stop…

Hegemon
- 77
- 10
0
votes
1 answer
Launched process from Scala terminates but Scala waits forever for its termination
I launch a process from an Ammonite script in this way:
scala.sys.process.Process(Seq("executable", "arg1", "arg2")).run().exitValue()
The launched process terminates ok, but it doesn't know about.
Normally it works ok and process termination is…

david.perez
- 6,090
- 4
- 34
- 57
0
votes
1 answer
scala or java library that will read .ssh/config
I have an entry in my .ssh/config file that looks like:
Host ip-172-16-*
ProxyCommand ssh jeff@jumpdev.example.org nc %h %p
User ubuntu
IdentityFile ~/.ssh/id_rsa_aws
StrictHostKeyChecking no
ForwardAgent yes
As most know this will allow me to…

ekydfejj
- 339
- 2
- 14
0
votes
1 answer
How can I access the last output value in the Scala REPL?
In Ruby, Python, and presumably a bunch of other REPLs, you can refer to the last value with _:
>> longCalculationIForgotToAssignToAVariable
42
>> foo = _
>> foo
42
How can I do this in the Scala REPL? I'm aware of the . feature of the REPL:
scala>…

Sasgorilla
- 2,403
- 2
- 29
- 56
0
votes
1 answer
How to ssh with Amonite supplying the password in advance
Problem: I need to access a command line API on a Remote machine.
I am playing with Scala Amonite libs, i wonder if there is a way to ssh and supply the password, so that i can do it from within an application and not have to enter the pass in the…

MaatDeamon
- 9,532
- 9
- 60
- 127