21 questions
0
votes
1
answer
85
views
In Scala script, avoid "Failed to load class org.slf4j.impl.StaticLoggerBinder"
When running my Scala script, I'm seeing a warning:
> scala upload.scala
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger ...
1
vote
1
answer
54
views
Import / include / using objects from another source file into a Scala script file
I have a MyScript.scala file:
//> using scala "3"
object MyUtils {
def sayHello() = println("Hello")
}
@main
def main(): Unit =
MyUtils.sayHello();
I successfully run it ...
4
votes
0
answers
218
views
How to use a private Repo with enviroment variables in a scala-cli Script
According to the scala-cli doc you can define a Repo like this:
//> using repository "https://maven-central.storage-download.googleapis.com/maven2"
And you can specify environment ...
0
votes
2
answers
1k
views
Running scala script with line breaks in spark-shell
I'm trying to run a scala script through spark shell using the following command:
spark-shell -i myScriptFile.scala
I can get the above command to work when I have single-line commands, but if I have ...
0
votes
0
answers
105
views
Scala Script Engine is not found when run in Test using Mill or SBT
I have a strange behaviour concerning Testing Scala Script Engine.
I have the following code:
val manager = new ScriptEngineManager(getClass.getClassLoader)
val e = manager.getEngineByExtension("...
0
votes
0
answers
28
views
Avoid recompiling Scalas script
I like the idea of using Scala as a scripting language (https://www.scala-sbt.org/1.x/docs/Scripts.html). However, it always takes a long time even for a simplest Hello World script to run, presumably ...
0
votes
3
answers
717
views
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):
...
0
votes
0
answers
154
views
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 ...
2
votes
1
answer
549
views
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:...
3
votes
2
answers
365
views
Issues with Scala ScriptEngine inside spark submit application
I am working on a system where I let users write DSLS and I load it as instances of my Type during runtime and these can be applied on top of RDDs. The entire application runs as a spark-submit ...
11
votes
2
answers
7k
views
Scala script doesn't run on Ubuntu
I have a previously working Scala script that when I try to run it on a new PC, the compilation fails.
So I made simple script to test:
#!/bin/sh
exec scala -J-Xmx2g "$0" "$@"
!#
println("test")
...
0
votes
0
answers
245
views
sbt scala script setup fail
I'm want setup scala script by sbt ways according to document here.
A error encountered when execute
java -Dsbt.main.class=sbt.ScriptMain -Dsbt.boot.directory=/home/user/.sbt/boot -jar sbt-launch.jar ...
0
votes
1
answer
162
views
how to use sbt/amm scala script on pipe operator?
I want to deal with log output with scala script. Like this:
java -jar app.jar | log.sc or java -jar app.jar | amm log.sc
How to write a log.sc deal with app.jar print logs?
motivation
Replace ...
-1
votes
1
answer
24
views
Running a scala script: changing function name and recompiling does not have an effect
After I change the function name from something else to addOptitrans and recompile, I get the following error:
make final_babylon DICTS=.* bash ../bin/babylon_add_optitrans.sh
DICTS=.* /tmp/...
-3
votes
2
answers
130
views
Scala language relates in some way with ScalaScript [closed]
My boss ia bashing Scala language due to an previous experience with ScalaScript from https://scala.com so are there some relationship between they?
I am trying to evagelize Scala in my company, so ...
-3
votes
1
answer
279
views
how do I use filter function in Scala script
As part of my learning, I am trying to write the Scala expression into a scala script but struck with an error.
The scala code I am having it successfully executed in Scala REPL is
def intList = ...
0
votes
1
answer
108
views
Running IntelliJ scala project error
I am not using IntelliJ 15 for a long time, but never ever had such an issue. When I do: New Project -> Scala, then everything works fine, but when I do New Project -> SBT, then I can't even have main,...
24
votes
2
answers
11k
views
What is the difference between scala classes, scripts and worksheets in Intellij-idea?
I'm using Intellij-idea for scala programming (with sbt plugin).
I want to know what is the difference between scala classes, scala scripts and scala worksheets. When we use each of them?
This will ...
0
votes
1
answer
259
views
Execute subcommand in Scala (script) and let it "take over"
I'd like to create a dummy script (with the prospect of writing a real life script) that invokes for example the Python interactive interpreter from within a Scala process and lets the user fully ...
0
votes
3
answers
963
views
Compiling Scala scripts. How works a Scala script?
Groovy
Groovy comes with a compiler called groovyc. For each script, groovyc generates a class that extends groovy.lang.Script, which contains a main method so that Java can execute it. The name of ...
9
votes
2
answers
2k
views
Shorter Scala Script header
It's possible to write shell scripts in Scala by starting a text file with:
#!/bin/sh
exec scala "$0" "$@"
!#
To ease script creation, I would like to write an executable called scalash (perhaps a ...