Skip to content

Ammonite embedded repl project binary generated using coursier bootstrap process gives an error. #887

@Poorva17

Description

@Poorva17

Hello,

We are using coursier bootstrap to generate binary executable for our sample ammonite project. We are facing following issue.

Binary generated using coursier bootstrap command fails to run if it generated using publishLocal (0.1.0-SNAPSHOT). On the contrary, binary generated using coursier bootstrap command runs as expected if it is generated using git SHA

We have created sample ammonite project to demonstrate this issue.

Steps to reproduce -
Approach1

sbt publishLocal

Bootstrapping using coursier

./coursier bootstrap -r jitpack --cfa com.github.Poorva17.ammonite-sample:sample_2.12:0.1.0-SNAPSHOT -M example.Main -f -o sample-bootstrap

Running the generated binary executable

Run the executable from the root of the project

./sample-bootstrap

It fails with error

./sample-bootstrap
Compiling (synthetic)/ammonite/predef/interpBridge.sc
ArrayBuffer()
java.lang.IllegalArgumentException: URI is not hierarchical
	at java.io.File.<init>(File.java:418)
	at ammonite.runtime.Classpath$.$anonfun$classpath$1(Classpath.scala:46)
	at scala.collection.TraversableLike.$anonfun$map$1(TraversableLike.scala:233)
	at scala.collection.IndexedSeqOptimized.foreach(IndexedSeqOptimized.scala:32)
	at scala.collection.IndexedSeqOptimized.foreach$(IndexedSeqOptimized.scala:29)
	at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:194)
	at scala.collection.TraversableLike.map(TraversableLike.scala:233)
	at scala.collection.TraversableLike.map$(TraversableLike.scala:226)
	at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:194)
	at ammonite.runtime.Classpath$.classpath(Classpath.scala:46)
	at ammonite.interp.CompilerLifecycleManager.init(CompilerLifecycleManager.scala:77)
	at ammonite.interp.CompilerLifecycleManager.preprocess(CompilerLifecycleManager.scala:50)
	at ammonite.interp.Interpreter.compileRunBlock$1(Interpreter.scala:497)
	at ammonite.interp.Interpreter.$anonfun$processAllScriptBlocks$9(Interpreter.scala:536)
	at scala.Option$WithFilter.map(Option.scala:146)
	at ammonite.interp.Interpreter.loop$1(Interpreter.scala:522)
	at ammonite.interp.Interpreter.processAllScriptBlocks(Interpreter.scala:589)
	at ammonite.interp.Interpreter.$anonfun$processModule$6(Interpreter.scala:385)
	at ammonite.util.Catching.flatMap(Res.scala:114)
	at ammonite.interp.Interpreter.$anonfun$processModule$5(Interpreter.scala:376)
	at ammonite.util.Res$Success.flatMap(Res.scala:61)
	at ammonite.interp.Interpreter.processModule(Interpreter.scala:366)
	at ammonite.interp.Interpreter.$anonfun$initializePredef$1(Interpreter.scala:121)
	at ammonite.interp.Interpreter.$anonfun$initializePredef$1$adapted(Interpreter.scala:121)
	at ammonite.interp.PredefInitialization$.$anonfun$apply$7(PredefInitialization.scala:65)
	at ammonite.util.Res$.$anonfun$fold$1(Res.scala:31)
	at scala.collection.LinearSeqOptimized.foldLeft(LinearSeqOptimized.scala:122)
	at scala.collection.LinearSeqOptimized.foldLeft$(LinearSeqOptimized.scala:118)
	at scala.collection.immutable.List.foldLeft(List.scala:85)
	at ammonite.util.Res$.fold(Res.scala:29)
	at ammonite.interp.PredefInitialization$.apply(PredefInitialization.scala:53)
	at ammonite.interp.Interpreter.initializePredef(Interpreter.scala:123)
	at ammonite.repl.Repl.initializePredef(Repl.scala:122)
	at ammonite.Main.run(Main.scala:192)
	at example.Main$.main(Main.scala:10)
	at example.Main.main(Main.scala)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at coursier.Bootstrap.main(Bootstrap.java:430)
()

Please note that it ONLY fails in case of publishLocal. Approach 2 and approach 3 works very well

Approach 2 - Ammonite app process runs as expected if used with git SHA as version for coursier to bootstrap.
e.g. -

./coursier bootstrap -r jitpack --cfa com.github.Poorva17.ammonite-sample:sample_2.12:1d3854c -M example.Main -f -o sample-bootstrap

Run the executable from the root of the project

./sample-bootstrap

Approach 3 - It also works as expected when running sbt sample/run from the root directory of the project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions