xerial / sbt-pack

A sbt plugin for creating distributable Scala packages.
496 stars 76 forks source link

packCopyDependencies doesn't remove duplicates before processing #166

Open DavidPerezIngeniero opened 5 years ago

DavidPerezIngeniero commented 5 years ago

After migrating to SBT 1.3.0 from 1.1.4, here is the result of running:

packCopyDependencies

java.nio.file.FileAlreadyExistsException: /home/dd/rds/servision/src/main/webapp/WEB-INF/lib/jt-utils-1.5.0.jar

The cause is that tries to create a symbolic link for the same dependency twice. It doesn't remove duplicated dependencies before processing.

xerial commented 5 years ago

It would be great if you can create a small project to reproduce the issue.

DavidPerezIngeniero commented 5 years ago

I'll try to when I have time. Meanwhile this is the workaround:

packCopyDependenciesUseSymbolicLinks := false
DavidPerezIngeniero commented 5 years ago

In addition, I've found that sbt-pack finds inexistant dependencies (or better said, excluded dependencies). There is a discrepancy between dependencies reported by sbt-pack and sbt-dependency-graph.

My project has tons of dependencies. For being more specific, here is an excerpt of my dependencies:

"commons-jelly" % "commons-jelly" % "1.0"
    exclude("xerces", "xmlParserAPIs")
    exclude("javax.servlet", "servlet-api")
    exclude("servlet-api", "servlet-api")
    exclude("dom4j", "dom4j")
    exclude("junit", "junit")
    exclude("jdom", "jdom")
    exclude("xalan", "xalan")
    exclude("com.ibm.icu", "icu4j")

sbt-pack consider com.ibm.icu % icu4j as a valid dependency, when in fact it is excluded.