"optional" config for library dependency is just a flag and shouldn't really map to a scope.
For example, having the following as library dependency:
libraryDependencies ++= "com.h2database" % "h2" % "1.2.147" % "optional"
results in the relevant dependency section as thus:
Per Maven's POM Reference, the scope is not a valid one. In this particular case, it should have been <scope>compile</scope> (the default).
This also means that the following rare and edge case is actually valid:
But there isn't a way to add such a dependency because "runtime" and "optional" are both treated as Configuration, and multiple Configurations are not allowed.
IMPORTANT This project has moved to https://github.com/sbt/sbt. This issue still exists to avoid dead links, but GitHub limitations prevent the original issue from being correctly preserved here. Please see sbt/sbt#162 for the full issue and to comment.