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)
switching my project to scala 3 results in
[error] -- [E007] Type Mismatch Error:
[error] 22 | os.symlink(symlink, dir)
[error] | ^^^^^^^^^^^^^^^^^^^^^^
[error] |Found: (Context.this.dir : os.Path#ThisType#ThisType)
[error] |Required: os.FilePath
[error] |
I guess that's an issue with different handling of implicits in Scala 3. Anything I could do?
import coursierapi.MavenRepository
interp.repositories() ++= Seq(
MavenRepository.of("https://packages.atlassian.com/maven-public/")
)
import $ivy.`com.atlassian.browsers:atlassian-browsers-auto:3.1.0`
@main
def main(): Unit = println("Hello")
Failed to resolve ivy dependencies:Error downloading com.atlassian.browsers:atlassian-browsers-auto:3.1.0
not found: /root/.ivy2/local/com.atlassian.browsers/atlassian-browsers-auto/3.1.0/ivys/ivy.xml
not found: https://repo1.maven.org/maven2/com/atlassian/browsers/atlassian-browsers-auto/3.1.0/atlassian-browsers-auto-3.1.0.pom
ammonite.$file.src.main.scala.response.Response_10.
repeated everywhere in error, making it really difficult to read.type mismatch;
found : ammonite.$file.src.main.scala.response.Response_10.UHttp[ammonite.$file.src.main.scala.response.Response_10.ChannelEvent[ammonite.$file.src.main.scala.response.Response_10.Request],ammonite.$file.src.main.scala.response.Response_10.ChannelOperation[ammonite.$file.src.main.scala.response.Response_10.Response]]
(which expands to) ammonite.$file.src.main.scala.response.Response_10.ChannelEvent[ammonite.$file.src.main.scala.response.Response_10.Request] => zio.ZIO[Any,Option[Nothing],ammonite.$file.src.main.scala.response.Response_10.ChannelOperation[ammonite.$file.src.main.scala.response.Response_10.Response]]
required: ammonite.$file.src.main.scala.response.Response_10.Http[?,?,ammonite.$file.src.main.scala.response.Response_10.ChannelEvent[Any],ammonite.$file.src.main.scala.response.Response_10.ChannelOperation[Nothing]]
(which expands to) ammonite.$file.src.main.scala.response.Response_10.ChannelEvent[Any] => zio.ZIO[?,Option[?],ammonite.$file.src.main.scala.response.Response_10.ChannelOperation[Nothing]]
type mismatch;
found : UHttp[ChannelEvent[Request],ChannelOperation[Response]]
(which expands to) ChannelEvent[Request] => zio.ZIO[Any,Option[Nothing],ChannelOperation[Response]]
required: Http[?,?,ChannelEvent[Any],ChannelOperation[Nothing]]
(which expands to) ChannelEvent[Any] => zio.ZIO[?,Option[?],ChannelOperation[Nothing]]
import $ivy.`com.lihaoyi::mainargs:0.2.1`
import mainargs.{main, arg, ParserForMethods, Flag}
@main
def run(@arg(short = 'f', doc = "String to print repeatedly")
foo: String,
@arg(name = "my-num", doc = "How many times to print string")
myNum: Int = 2,
@arg(doc = "Example flag, can be passed without any value to become true")
bool: Flag) = {
println(foo * myNum + " " + bool.value)
}
def main(args: Array[String]): Unit = ParserForMethods(this).runOrExit(args)
$ amm args-test.sc
Compiling /root/args-test.sc
Hi, I am trying to download artefacts for an ammonite script from our internal maven repository which needs authentication.
I have following solution which works, but the issue is I will have to commit username and password in our git repo which is not desirable.
import coursierapi.MavenRepository
import coursierapi.Credentials
val credentials = Credentials.of(username, password)
val privaterepo = MavenRepository.of("https://internal.repo.com/repository/releases").withCredentials(credentials)
interp.repositories.update(
interp.repositories() ::: List(privaterepo)
)
@
Two possible solutions I am exploring are,
fetch
command with coursier cli, so credentials file is in correct default location and in correct format. But with Ammonite script, somehow coursier doesn't use this property file.Can someone help me, possibly with working example on how to approach this?
Option(System.getProperty("internal.repo.username")).getOrElse(throw new Error("Username not defined"))
Credentials can be passed via property files too. By default, ~/.config/coursier/credentials.properties is read (~/Library/Application Support/Coursier/credentials.properties on OS X).
I'm getting a very bizarre issue combining Ammonite 3 with cats-effect. The following script hangs between printing "1" and "2":
#!/usr/bin/env amm
import $ivy.`org.typelevel::cats-effect:3.1.1`
import cats.effect.IO
import cats.effect.unsafe.IORuntime
def g() : IO[Unit] = IO(())
object HelloWorld {
def f() : IO[Unit] = IO(())
val blah : IO[Unit] = for {
x <- f()
_ <- IO(println("1"))
y <- g()
_ <- IO(println("2"))
} yield ()
}
HelloWorld.blah.unsafeRunSync()(IORuntime.global)
It seems as though it hangs on call to the top level function g()
but not the member function f()
. Any idea what's happening here?
PS C:\Users\Xie> amm
Loading...
Compiling C:\Users\Xie\.ammonite\predef.sc
Compiling C:\Users\Xie\.ammonite\predef.sc #2
7月 08, 2021 10:40:17 上午 org.jline.utils.Log logr
警告: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
Welcome to the Ammonite Repl 2.4.0 (Scala 2.13.6 Java 11.0.2)
Writing a Ammonite script like this:
#!/usr/bin/env amm
//... imports, etc.
@main(doc = "one entrypoint")
def entryOne() = {
???
}
@main(doc = "another entrypoint")
def entryTwo() = {
???
}
Running it results in:
% ./test.sc
Need to specify a sub command: entryOne, entryTwo
Is there a way to have Ammonite print a usage message including the doc
from the @main
annotation?
amm
it fails on start up with this error: "Failed to resolve ivy dependencies". My ~/.ammonite/predef.sc looks like this http://i.jsatk.us/FY5FlN
java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: ammonite/util/Frame
org.apache.spark.sql.ammonitesparkinternals.AmmoniteSparkSessionBuilder.getOrCreate(AmmoniteSparkSessionBuilder.scala:209)
ammonite.predef.predef$Helper.<init>(predef.sc:21)
ammonite.predef.predef$.<init>(predef.sc:7)
ammonite.predef.predef$.<clinit>(predef.sc)
Hi, I am new to ammonite and following the documentation I am unable to import using the magic ivy import. Importing the following
masonedmison-masonedmison@ import $ivy.`org.scalaz::scalaz-core:7.2.27`
Failed to resolve ivy dependencies:Error downloading org.scalaz:scalaz-core_3:7.2.27
not found: /Users/masonedmison/.ivy2/local/org.scalaz/scalaz-core_3/7.2.27/ivys/ivy.xml
not found: https://repo1.maven.org/maven2/org/scalaz/scalaz-core_3/7.2.27/scalaz-core_3-7.2.27.pom
yields an error. Can someone please advice tips to troubleshoot this issue? Thanks in advance.
❯ cs complete org.scalaz:scalaz-core_3:
7.4.0-M7
❯ cs complete org.typelevel:cats-effect_3:
2.5.1
3.1.1
3.2.0
scala-utils
plugin, right inside Neovim