alexarchambault on 1.6.3
alexarchambault on master
1.6.3 (compare)
lihaoyi on gh-pages
5ad9ae5538f23cab92ccd8c6b1617d8… (compare)
alexarchambault on master
Partly revert 84d48542 (#923) … (compare)
2.11
is getting quite old, 2.12
has been out for almost 3 years now(!)
interp.resolutionHooks += { fetch =>
fetch.withClassifiers(fetch.classifiers.filter(_ != "sources"))
}
Hi, any idea why I get java.lang.ClassNotFoundException: scala.jdk.CollectionConverters$
issues with amm-2.12-1.7.4
and not with amm-2.13-1.7.4
, and not at all within the test (sbt +test
) of my project which cross-compiles 2.11, 2.12, 2.13 (https://github.com/dacr/drools-scripting) using scala-collection-compat
library.
10:46 $ amm-2.12-1.7.4 drools-hello-world.sc
Compiling (synthetic)/ammonite/predef/interpBridge.sc
Compiling (synthetic)/ammonite/predef/sourceBridge.sc
Compiling (synthetic)/ammonite/predef/frontEndBridge.sc
Compiling (synthetic)/ammonite/predef/DefaultPredef.sc
Compiling /home/dcr/notes/scripts/drools-hello-world.sc
drools$minushello$minusworld$HelloTest:
Drools
ammonite.$file.drools$minushello$minusworld$HelloTest$ *** ABORTED ***
...
10:48 $ amm-2.13-1.7.4 drools-hello-world.sc
Compiling (synthetic)/ammonite/predef/interpBridge.sc
Compiling (synthetic)/ammonite/predef/sourceBridge.sc
Compiling (synthetic)/ammonite/predef/frontEndBridge.sc
Compiling (synthetic)/ammonite/predef/DefaultPredef.sc
Compiling /home/dcr/notes/scripts/drools-hello-world.sc
drools$minushello$minusworld$HelloTest:
Drools
- should say hello
I'm not sure it is a bug, if it is I'll fill a dedicated issue, the executed code is the following : https://gist.github.com/dacr/6921d569fd33182da358d6a8e383aa0a :
import $ivy.`org.scalatest::scalatest:3.0.8`
import $ivy.`fr.janalyse::drools-scripting:1.0.1`
import org.scalatest._, org.scalatest.OptionValues._
import fr.janalyse.droolscripting._
object HelloTest extends FlatSpec with Matchers {
"Drools" should "say hello" in {
val drl =
"""package testdrools
|rule "hello" when
|then
| insert("HELLO WORLD");
|end
|""".stripMargin
val engine = DroolsEngine(drl)
engine.fireAllRules()
engine.getObjects.headOption.value shouldBe "HELLO WORLD"
}
}
HelloTest.execute()
Hi guys,ammonite-sshd
doesn't run predef
when running inside docker container.
I'm running ammonite embedded in play server. When I start play via runProd
and connect to ammonite via ssh I get this
Compiling /home/milan/dev/traceability/traceability/server/playserver/target/universal/stage/(console)
Setting front-end. // My println in predef
Welcome to the Ammonite Repl 1.7.4
However when I run the same play server inside alpine-java docker container I only get this:
Password:
Welcome to the Ammonite Repl 1.7.4
Any ideas?
大学院小学高校入試高校受験
校
. Even Cmd+E doesn't work and it doesn't take you to the end of the line.
Test / useSuperShell := false
but it did not work. Does someone has an alternative workaround than just calling sbt with --supershell=false
?
I had the following two lines in my predef.sc
import coursier.MavenRepository
interp.repositories() ++= Seq(MavenRepository("https://repository.mulesoft.org/nexus/content/repositories/public/"))
These used to work fine. today I upgraded my ammonite to 1.7.4 and now its broken. Error
predef.sc:17: not found: value coursier
import coursier.MavenRepository
I develop a small DSL in scala. It works in Scala's REPL. But in Ammonite, I get the following error:
@ val formula = "class" ~
cmd2.sc:1: value ~ is not a member of String
val formula = "class" ~
^
Compilation Failed
All my classes and implicit conversation are already imported.
scala> val formula = "class" ~
formula: smile.data.formula.FormulaBuilder = FormulaBuilder(Some(class),ListBuffer())
ammonite.$sess.cmd29$Helper$SimpleTuple
without access to the scope that this class was defined in.case class SimpleTuple(id: Int, desc: String) {
def >(other:SimpleTuple) = this.id > other.id
}
case class SimpleTuple4(id: Int, desc: String) {
def >(other:SimpleTuple4) = this.id > other.id
}
org.apache.spark.sql.catalyst.encoders.OuterScopes.addOuterScope(this)
textFile.map(line => SimpleTuple4(line.split(" ").size,line)).reduce((a, b) => if (a > b) a else b)
Main
as suggested in https://ammonite.io/#Debugging, and running it with the run
command inside sbt
, but that did not work...
@diesalbla Use this :
libraryDependencies += {
val version = scalaBinaryVersion.value match {
case "2.10" => "1.0.3"
case _ ⇒ "1.8.0"
}
"com.lihaoyi" % "ammonite" % version % "test" cross CrossVersion.full
}
sourceGenerators in Test += Def.task {
val file = (sourceManaged in Test).value / "amm.scala"
IO.write(file, """object amm extends App { ammonite.Main.main(args) }""")
Seq(file)
}.taskValue
and if you want, add a shortcut :addCommandAlias("repl", "test:runMain amm")
Anyone familiar with importing from a secure private bintray? I've tried to follow various snippets I've found through Google, but can't make it go.
import coursier.core.Authentication, coursier.MavenRepository
interp.repositories() ++= Seq(MavenRepository(
"https://some.bintray.com/maven"
authentication = Some(Authentication("user", "pass"))
))
import $ivy.{
`com.some:artifact_2.12:1.0.9-85`
}
gives me
Failed to resolve ivy dependencies:Error downloading com.some:artifact_2.12:1.0.9-85
not found: /Users/nderraugh/.ivy2/local/com.some/artifact_2.12/1.0.9-85/ivys/ivy.xml
not found: https://repo1.maven.org/maven2/com/some/artifact_2.12/1.0.9-85/artifact_2.12-1.0.9-85.pom
HI, may be somebody can assist
I have to call
git blame <file> | grep -n '^0{8} ' | cut -f1 -d:
This gives me line numbers of changed git files
Can I somehow to execut this as a native command, it just hungs
Ammonite-Shell/Scripting
chapter in documentation I understand that this usecase is supported. One of essentials here is an ability to invoke system binaries. I see we have this ability throuhg %
, %%
commands. I have installed ammonite per instructions on ammonite.io
. In this setup percent commands are available only when amm is run interactivly. This is because predef code with necessary imports is pre-executed only for interactive sessions. Should I solve this by importing predef file by hand in all my future scripts? Or is this a bad idea for some reason. If on the other hand it is a good idea why predef is not pre-executed when scripts are run non-interactively as well? Or is there another .ammonite file which is run before scripts like this? I hope you see my confusion. And thanks for ammonite!