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

Duplicate mappings for scala-library-2.10.3.jar with sbt-native-packager 0.7+, Play 2.2.6 and Scala 2.10 #657

Closed
mslinn opened this issue Sep 1, 2015 · 7 comments
Labels
bug universal Zip, tar.gz, tgz and bash issues

Comments

@mslinn
Copy link

mslinn commented Sep 1, 2015

I'm stuck with Play 2.2.6 and Scala 2.10 for a project. sbt-native-packager 0.6.4 is compatible, but has a bug I can't live with (passing a relative path to scriptClasspath throws java.lang.IllegalArgumentException: character to be escaped is missing). I see this got fixed in sbt-native-packager 0.7.0.

Unfortunately, when I try the sbt stage task using sbt-native-packager 0.7.0 or later I get:

java.lang.RuntimeException: Duplicate mappings:
/work/myProject/target/universal/stage/lib/org.scala-lang.scala-library-2.10.3.jar
from
/opt/play-2.2.6/repository/local/org.scala-lang/scala-library/2.10.3/jars/scala-library.jar
/home/mslinn/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.10.3.jar

Suggestions?

@muuki88
Copy link
Contributor

muuki88 commented Sep 18, 2015

Sorry for the late reply. This bug seems a bit deeper in sbt. Currently I have no idea what causes this :(

@mslinn
Copy link
Author

mslinn commented Oct 13, 2015

This bug is causing us a lot of grief. I reached out to @jsuereth a few weeks ago regarding this issue but got no reply.

@muuki88
Copy link
Contributor

muuki88 commented Oct 13, 2015

I imagine it does, but this is an open source project and we have as much resources as our community provides. If you need any help on debugging this, you can seek guidance, we are happy to help.

@ahjohannessen provided a repo to reproduce the bug (see chat log here)

@mslinn
Copy link
Author

mslinn commented Oct 13, 2015

I took a shortcut and patched the 0.6 branch so I could fix the error there. Here is the forked GitHub project, complete with instructions on how to install it.

@muuki88
Copy link
Contributor

muuki88 commented Oct 14, 2015

I took a look where these bindings come from. With the repo mentioned above, I found that spray jars are added as bundle and jar. Adding this to the build.sbt reveales:

val showMappings = taskKey[Unit]("showMappings") 

showMappings := {
  (mappings in Universal).value
  .filter(_._2 contains "spray")
  .foreach {
    case (file, path) => println(file + " -> " + path)
  }
}
sbt universal:showMappings
..io.spray/spray-json_2.11/jars/spray-json_2.11-1.3.1-sources.jar -> lib/io.spray.spray-json_2.11-1.3.1-sources.jar
..io.spray/spray-json_2.11/jars/spray-json_2.11-1.3.1.jar -> lib/io.spray.spray-json_2.11-1.3.1.jar
..io.spray/spray-client_2.11/jars/spray-client_2.11-1.3.2-sources.jar -> lib/io.spray.spray-client_2.11-1.3.2-sources.jar
..io.spray/spray-client_2.11/jars/spray-client_2.11-1.3.2.jar -> lib/io.spray.spray-client_2.11-1.3.2.jar
..io.spray/spray-can_2.11/bundles/spray-can_2.11-1.3.2.jar -> lib/io.spray.spray-can_2.11-1.3.2.jar
..io.spray/spray-io_2.11/bundles/spray-io_2.11-1.3.2.jar -> lib/io.spray.spray-io_2.11-1.3.2.jar
..io.spray/spray-util_2.11/bundles/spray-util_2.11-1.3.2.jar -> lib/io.spray.spray-util_2.11-1.3.2.jar
..io.spray/spray-http_2.11/bundles/spray-http_2.11-1.3.2.jar -> lib/io.spray.spray-http_2.11-1.3.2.jar
..io.spray/spray-httpx_2.11/bundles/spray-httpx_2.11-1.3.2.jar -> lib/io.spray.spray-httpx_2.11-1.3.2.jar

Question is. Why are jars and bundles in these mappings. I guess this in the same issue for the scala library.

@yfyf
Copy link
Contributor

yfyf commented Jul 14, 2016

Perhaps obvious, but disabling cached resolution seems to resolve this at least for me. YMMV.

@peter-fu
Copy link

Same here, enabled cached resolution today with sbt 0.13.12 and the error "Duplicate mappings" occurred for activator stage.

Play 2.3.10
sbt 0.13.2
sbt-native-packager 1.1.4

Workaround, same as @yfyf, disable cached resolution before activator stage.

@muuki88 muuki88 closed this as completed Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug universal Zip, tar.gz, tgz and bash issues
Projects
None yet
Development

No branches or pull requests

4 participants