in ensime we see this
[info] Shading 7 JAR(s):
[info] /home/fommil/.coursier/cache/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier-cache_2.12/1.0.0-RC12/coursier-cache_2.12-1.0.0-RC12.jar
[info] /home/fommil/.coursier/cache/v1/https/repo1.maven.org/maven2/io/get-coursier/coursier_2.12/1.0.0-RC12/coursier_2.12-1.0.0-RC12.jar
[info] /home/fommil/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.6/scala-xml_2.12-1.0.6.jar
[info] /home/fommil/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scala-lang/scala-library/2.12.3/scala-library-2.12.3.jar
[info] /home/fommil/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scalaz/scalaz-concurrent_2.12/7.2.13/scalaz-concurrent_2.12-7.2.13.jar
[info] /home/fommil/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scalaz/scalaz-core_2.12/7.2.13/scalaz-core_2.12-7.2.13.jar
[info] /home/fommil/.coursier/cache/v1/https/repo1.maven.org/maven2/org/scalaz/scalaz-effect_2.12/7.2.13/scalaz-effect_2.12-7.2.13.jar
[info] :: delivering :: org.ensime#sbt-ensime;1.12.16-SNAPSHOT :: 1.12.16-SNAPSHOT :: integration :: Sun Sep 24 16:44:33 BST 2017
[info] delivering ivy file to /tmp/fommil-sbt/home/fommil/Projects/ensime-sbt/target/ivy-1.12.16-SNAPSHOT.xml
[info] Main Scala API documentation to /tmp/fommil-sbt/home/fommil/Projects/ensime-sbt/target/api...
[info] Compiling 6 Scala sources to /tmp/fommil-sbt/home/fommil/Projects/ensime-sbt/target/scala-2.12/sbt-1.0/classes...
[info] Found 6817 class(es) in JAR(s) to be shaded
[info] 778 classes already filtered out by shaded namespace coursier
[info] 3298 classes already filtered out by shaded namespace scalaz
[info] 2741 remaining class(es) to be shaded
model contains 22 documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /tmp/fommil-sbt/home/fommil/Projects/ensime-sbt/target/sbt-ensime-1.12.16-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] Packaging /tmp/fommil-sbt/home/fommil/Projects/ensime-sbt/target/scala-2.12/sbt-1.0/sbt-ensime-1.12.16-SNAPSHOT.jarg ...
[info] Done packaging.
and it just hangs forever here with the CPU spinning....
Best ticket number. Ever.
Quickly looked at it. The 2741 remaining class(es) to be shaded is suspicious here. It means things outside the coursier and scalaz namespaces (from the shadedNamespaces setting) is getting shaded too. In the output, it says the JAR of scala-library and scala-xml are about to be shaded. For whatever reason, these are only pulled by the dependency on coursier, so are shaded too.
That can be prevented by explicitly depending on them, with
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-library" % scalaVersion.value,
"org.scala-lang.modules" %% "scala-xml" % "1.0.6"
)
That solves the problem for me.
that's probably paradise... but nothing is appearing in the jar file except my files. Nothing from coursier or scalaz.
to reproduce, take these https://github.com/ensime/ensime-sbt/blob/50176bc969cc102dad93eebd8a986a7857ebb6f8/build.sbt#L9-L31
and put them into the build.sbt in the 2.0 or 3.0 branch (currently both the same)
The lines above fix the problem. I started from https://github.com/ensime/ensime-sbt/pull/360/commits/dd40ab0066a30b2279595d112ae05af123a14847, re-enabled shading, ran into the problem, and fixed it with those lines.
Also, the sbtLauncher := … isn't necessary anymore with sbt-coursier 1.0.0-RC12.
awesome, I'll look into this and hopefully release 2.0.1 before announcing
good stuff, that seems to have fixed it!