We are using sbt-onejar and as expected but not intended all the jars along with thier transitive dependencies were getting included in the jar. This was giving us several warnings like
JarClassLoader: Warning: org/hamcrest/BaseDescription.class in lib/mockito-all-1.8.5.jar is hidden by lib/junit-4.7.jar (with different bytecode)
JarClassLoader: Warning: org/hamcrest/BaseMatcher.class in lib/mockito-all-1.8.5.jar is hidden by lib/junit-4.7.jar (with different bytecode)
when we we executing code.
To remove this, you need to have the intransitive() suffixed to the dependency like this
libraryDependencies += “org.scalatest” % “scalatest_2.9.0″ % “1.6.1″ intransitive()
libraryDependencies += “org.specs2″ % “specs2_2.9.0-1″ % “1.5″
libraryDependencies += “org.clapper” % “classutil_2.9.0″ % “0.3.6″
libraryDependencies += “org.clapper” % “avsl_2.9.0″ % “0.3.2″
libraryDependencies += “org.jsoup” % “jsoup” % “1.6.1″ intransitive()
You would do it for all the dependencies where you have some jars which could be stepping on the toes of others because of transitive dependency.
Filed under: Java Tagged: jars, sbt, scala
