deeplearning4j-docs icon indicating copy to clipboard operation
deeplearning4j-docs copied to clipboard

Add SBT uber-jar creation info

Open AlexDBlack opened this issue 7 years ago • 3 comments

Something that some SBT users run into is uber-jars that give a Nd4jBackend.NoAvailableBackendException, due to incorrect packaging with plugins like sbt-assembly plugin (for example, missing or not adding java service loader files under /META-INF/services/

Having something we can point users to for this would be useful.

Due Date

To be completed by: YYYY-MM-DD

Description

Write a short description of what needs to be done.

Assignees

Please ensure you have assigned at least one person to this issue. Include any authors and reviewers required.

AlexDBlack avatar Aug 28 '18 00:08 AlexDBlack

From gitter: Cause for one user was discard merge strategy removing all of the service loader files:

assemblyMergeStrategy in assembly := {
    case PathList("META-INF", xs @ _*) => MergeStrategy.discard
    case x => MergeStrategy.first
}   

Fixed by:

assemblyMergeStrategy in assembly := {
    case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
    case x => MergeStrategy.first
}

(Note that this discards the manifest file, which is probably OK in most cases, but not all)

AlexDBlack avatar Aug 28 '18 00:08 AlexDBlack

@AlexDBlack where are you thinking we should put this? In this page? https://deeplearning4j.org/docs/latest/deeplearning4j-config-buildtools

crockpotveggies avatar Sep 22 '18 19:09 crockpotveggies

Thanks. The above fix worked for me. I was struggling with this for quite a while. I saw it using sbt 1.3.8, sbt-assembly 0.14.10, and nd4j 1.0.0-beta3 and 1.0.0-beta6

barrybecker4 avatar Mar 07 '20 22:03 barrybecker4