Skip to content

`optional` config for library dependency maps to incorrect scope #162

Closed
harrah opened this Issue Jan 5, 2013 · 1 comment

1 participant

@harrah
Owner
harrah commented Jan 5, 2013

"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:

<dependency>
  <groupId>com.h2database</groupId>
  <artifactId>h2</artifactId>
  <version>1.2.147</version>
  <scope>optional</scope>
  <optional>true</optional>
</dependency>

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:

<dependency>
  <groupId>com.h2database</groupId>
  <artifactId>h2</artifactId>
  <version>1.2.147</version>
  <scope>runtime</scope>
  <optional>true</optional>
</dependency>

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.

@harrah
Owner
harrah commented Jan 5, 2013

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.

@harrah harrah closed this Jan 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.