Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No documentation #100

Open
eatkins opened this issue Sep 17, 2019 · 7 comments
Open

No documentation #100

eatkins opened this issue Sep 17, 2019 · 7 comments

Comments

@eatkins
Copy link

eatkins commented Sep 17, 2019

I'm making a small change to the sbt xMain entry and I'd like to test with this launcher. I cannot figure out how to run it however. With the regular launcher, I can just run java -jar $LAUNCHER but it seems like I have to specify the full classpath of the coursier launcher dependencies to run the coursier launcher? Is there any documentation anywhere?

@dwijnand
Copy link

https://github.com/coursier/sbt-extras is probably the easiest way to run it.

@eatkins
Copy link
Author

eatkins commented Sep 17, 2019

I'm having a similar issue when I use sbt-extras:

xsbt -v -sbt-jar /Users/ethanatkins/.ivy2/local/io.get-coursier/sbt-launcher_2.12/1.2.17+3-59961fbe-SNAPSHOT/jars/sbt-launcher_2.12.jar 
Using sbt options defined in variable $SBT_OPTS
[residual] arg = '-XX:+HeapDumpOnOutOfMemoryError'
[residual] arg = '-XX:MaxMetaspaceSize=1g'
Detected sbt version 1.3.0
Using default jvm options
Detected Java version: 8
# Executing command line:
java
-Xms512m
-Xss2m
-jar
/Users/ethanatkins/.ivy2/local/io.get-coursier/sbt-launcher_2.12/1.2.17+3-59961fbe-SNAPSHOT/jars/sbt-launcher_2.12.jar
-XX:+HeapDumpOnOutOfMemoryError
-XX:MaxMetaspaceSize=1g

saving stty: gfmt1:cflag=4b00:iflag=6b02:lflag=5cb:oflag=3:discard=f:dsusp=19:eof=4:eol=ff:eol2=ff:erase=7f:intr=3:kill=15:lnext=16:min=1:quit=1c:reprint=12:start=11:status=14:stop=13:susp=1a:time=0:werase=17:ispeed=9600:ospeed=9600
Exception in thread "main" java.lang.NoClassDefFoundError: scala/collection/Seq
        at coursier.sbtlauncher.MainApp.main(MainApp.scala)
Caused by: java.lang.ClassNotFoundException: scala.collection.Seq
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 1 more

Am I doing something wrong? Is there a different option besides -sbt-jar? I also don't understand how it would work if I didn't have a locally published version of the launch jar.

@dwijnand
Copy link

It'll download the launch jar. The official sbt-extras downloads the official launch jar, while the coursier one uses this one.

@alexarchambault
Copy link
Member

Sorry about that @eatkins. To generate a launcher from source, I do something like

$ sbt publishLocal # note the version it uses, something like 1.2.16+7-fa40d050-SNAPSHOT
$ VERSION=1.2.16+7-fa40d050-SNAPSHOT scripts/generate-csbt.sh -r ivy2Local -f
$ ./csbt # the newly generated launcher

@alexarchambault
Copy link
Member

There's no sbt task to generate the launcher, currently. It relies on the bootstrap command of coursier, that creates a tiny JAR (a "bootstrap") that creates classloader hierarchy, with org.scala-sbt:launcher-interface in a first loader, and the rest of io.get-coursier::sbt-launcher in a loader with the first one as parent. That hierarchy is created by the --shared option passed to the coursier command in the generate-csbt.sh script.

@alexarchambault
Copy link
Member

alexarchambault commented Sep 17, 2019

@eatkins @dwijnand ~/.ivy2/local/io.get-coursier/sbt-launcher_2.12/X.Y.Z-SNAPSHOT/jars/sbt-launcher_2.12.jar can't be passed to sbt-extras, it has to be the "bootstrap" generated by the generate-csbt.sh script (see my commands above).

@eatkins
Copy link
Author

eatkins commented Sep 19, 2019

@alexarchambault thanks for the instructions. I got it working with them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants