Downloading source jars in sbt?

sbt

Solution

Add `withSources()` to the dependency definition.

From Download Sources in the official documentation of sbt:

Downloading source and API documentation jars is usually handled by an IDE plugin. These plugins use the updateClassifiers and updateSbtClassifiers tasks, which produce an Update Report referencing these jars.

To have sbt download the dependency's sources without using an IDE plugin, add `withSources()` to the dependency definition. For API jars, add `withJavadoc()`. For example:

libraryDependencies += "org.apache.felix" % "org.apache.felix.framework" % "1.8.0" withSources() withJavadoc()

Note that this is not transitive. Use the `update-*classifiers` tasks for that.

Problem

I pulled down the sources and build/published it locally. I want to debug into sources jars. When I publish it locally, I clearly see it also publishes source jars. ``` [info] published securesocial-testkit_2.10 to local\ws.securesocial\securesocial-testkit_2.10\master-SNAPSHOT\srcs\securesocial-testkit_2.10-sources.jar ``` I don't know how to reference this jar. Changing `"ws.securesocial" %% "securesocial" % "master-SNAPSHOT"` to `"ws.securesocial" %% "securesocial" % "master-SNAPSHOT-sources"` doesn't work.

Original source