Reputation: 170815
Maven has the optional dependency concept. Search of the SBT documentation for optional dependencies finds only "However, sometimes we have optional dependencies for special features.".
How can I declare an optional dependency in SBT?
Upvotes: 7
Views: 2052
Reputation: 1033
Unfortunately SBT documentation doesn't list all available scopes that map to Ivy Configurations, but the source code does: https://github.com/sbt/sbt/blob/0.13/ivy/src/main/scala/sbt/Configuration.scala
You can do this in the same way you scope a dependency for test, runtime or provided scope.
libraryDependencies += "group id" % "artifact id" % "version" % "optional"
or
libraryDependencies += "group id" % "artifact id" % "version" % Optional
Upvotes: 10