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

old slf4j pulled by jdeb breaks sbt-web asset pipeline #291

Closed
guersam opened this issue Jul 11, 2014 · 11 comments
Closed

old slf4j pulled by jdeb breaks sbt-web asset pipeline #291

guersam opened this issue Jul 11, 2014 · 11 comments

Comments

@guersam
Copy link

guersam commented Jul 11, 2014

After upgrading sbt-native-packager 0.7.2 from 0.7.2-RC2 in a Play 2.3 project, I'm getting this error when running assets:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/guersam/.ivy2/cache/org.slf4j/slf4j-nop/jars/slf4j-nop-1.5.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/guersam/.ivy2/cache/org.slf4j/slf4j-jdk14/jars/slf4j-jdk14-1.5.6.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/guersam/.ivy2/cache/org.slf4j/slf4j-simple/jars/slf4j-simple-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: slf4j-api 1.6.x (or later) is incompatible with this binding.
SLF4J: Your binding is version 1.5.5 or earlier.
SLF4J: Upgrade your binding to version 1.6.x.
[trace] Stack trace suppressed: run last web-plugin:webJarsNodeModules for the full output.
[trace] Stack trace suppressed: run last web-assets:webJars for the full output.
[error] (web-plugin:webJarsNodeModules) java.lang.NoSuchMethodError: org.slf4j.impl.StaticLoggerBinder.getSingleton()Lorg/slf4j/impl/StaticLoggerBinder;
[error] (web-assets:webJars) java.lang.ExceptionInInitializerError

It's caused by org.vafer:jdeb:1.2 which depends on org.apache.maven:maven-core:2.2.1, bringing tons of slf4j-api:1.5.x for related libraries.

Is there any workaround to remove jdeb? I tried addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.7.2" exclude ("org.vafer", "jdeb")) but had no luck.

@muuki88
Copy link
Contributor

muuki88 commented Jul 11, 2014

The workaround is to force to a slf4j version. When you add this to your plugins.sbt everything works. However we will target this issue (hopefully from both sides)

libraryDependencies ++= Seq(
    "org.slf4j" % "slf4j-api"       % "1.7.7" force(),
    "org.slf4j" % "slf4j-nop"       % "1.7.7" force(),
    "org.slf4j" % "slf4j-jdk14"     % "1.7.7" force(),
    "org.slf4j" % "jcl-over-slf4j"  % "1.7.7" force()
)

@guersam
Copy link
Author

guersam commented Jul 11, 2014

It works, thanks!

@muuki88
Copy link
Contributor

muuki88 commented Jul 11, 2014

@jsuereth , I was not able to exclude the org.slf4j dependencies from the dependency :(
Neither exclude nor excludeAll worked.

    "org.vafer" % "jdeb" % "1.2" artifacts (Artifact("jdeb", "jar", "jar")) excludeAll(
       ExclusionRule(organization = "org.slf4j")
    )

slf4j doesn't show up in the dependencies, but still there at runtime :/

@benmccann
Copy link
Contributor

Fixed in jdeb here: tcurdt/jdeb#174. Need a new jdeb release so that we can update sbt-native-packager to use it. Btw, the workaround above caused some issues in Play per the linked issue, so might want to be careful using it

@muuki88
Copy link
Contributor

muuki88 commented Jul 23, 2014

Thanks for putting this information here! Hopefully the release won't take two month :)

@muuki88
Copy link
Contributor

muuki88 commented Jul 25, 2014

@benmccann I saw your ticket [tcurdt/jdeb/issues/175]. I'm playing around with the though removing the jdeb support in a 0.7.4 release and putting it back in, when jdeb 1.3 is released.

@benmccann
Copy link
Contributor

Pull request here to upgrade to 1.3 :-) #307

@jsuereth
Copy link
Member

Also related, jdeb appears to have lots of version ranges and significantly hurt the activator offline repository. I'm actually debating whether or not it's worth it to try to do classloader isolation on jdeb rather than using it directly.

i.e. we'd resolve it somewhere and use it via reflection rather than directly. In any case, these are all workable problems, just thought I'd share that slf4j isn't the only issue with jdeb's massive dependency list.

@benmccann
Copy link
Contributor

@jsuereth good to know. looks like the version ranges aren't in jdeb directly, but are somewhere in the transitive dependency chain. it'd be worth upgrading to 1.3 and then seeing if the problem still exists or whether it's as severe since it removes three jdeb dependencies and upgrades most of the remaining to much newer versions

@muuki88
Copy link
Contributor

muuki88 commented Jul 28, 2014

@benmccann, @jsuereth I'm sure the upgrade will resolve a lot of stuff as all the maven2 dependencies which are more then 5 (?) years old are replaced.

If there are still problems, we have to refactor this out :/

@benmccann
Copy link
Contributor

This is fixed now with 0.7.4 released! Looks like we can close this one =)

@muuki88 muuki88 closed this as completed Jul 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants