sbt-scapegoat
sbt-scapegoat copied to clipboard
Do not include scapegoat class files in assembled jar
When I add the scapegoat plugin
addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.4")
Its class files are being included in my assembly when I run sbt assembly.
eg:
assembly [info] Including from cache: slf4j-api-1.7.5.jar [info] Including from cache: logback-classic-1.0.13.jar [info] Including from cache: scaldi_2.11-0.4.jar [info] Including: scala-xml_2.11-1.0.2.jar [info] Including from cache: config-1.2.1.jar [info] Including from cache: scalac-scapegoat-plugin_2.11-1.0.0.jar [info] Including from cache: logback-core-1.0.13.jar
Any update on this?
Almost 2MB are added into the fat jar for nothing, requiring a custom assembly
merge strategy.
Someone will need to make a pr as I don't know enough about SBT to fix it.
@sksamuel I will try to have a look in my spare time then ;)
Thanks.
FWIW, this is the approach I took in my assembly configuration to get around this:
assemblyExcludedJars in assembly := {
val cp = (fullClasspath in assembly).value
// exclude the scapegoat plugin that is sneaking into the assembled jar
cp filter {_.data.getName.matches("scalac-scapegoat-plugin.*\\.jar")}
}
+1
This should be fixed by #58 now released in v1.0.8. scalac-scapegoat-plugin is not included by assembly anymore.
If I try using 1.0.8 I now get the opposite problem:
[error] java.lang.Exception: Fatal: scalac-scapegoat-plugin not in libraryDependencies (Vector(...big long list of dependencies...))
[error] at com.sksamuel.scapegoat.sbt.ScapegoatSbtPlugin$.$anonfun$projectSettings$4(ScapegoatSbtPlugin.scala:67)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
...
@ashleymercer I had the same problem on my project (scala 2.11.12, sbt 1.0.4, sbt-scapegoat 1.0.8) and had to add the dependency "com.sksamuel.scapegoat" %% "scalac-scapegoat-plugin" % "1.3.3"
and still filter it in the assembly.
I've same issue as @ashleymercer with 1.0.8 version. With 1.0.7 everything is ok. To reproduce the issue, run from console:
> sbt
> scapegoat