Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Libraries marked as "provided' don't get their sources linked #154

DaGenix opened this Issue Mar 19, 2013 · 8 comments


None yet
8 participants

DaGenix commented Mar 19, 2013

Sbteclipse doesn't seem to handle dependencies used with the "provided" configuration correctly when using with-sources=true. These dependencies will correctly be included in the generated eclipse project, however, their source code will not be linked to the library in the Eclipse project. "compile" and (probably) "test" dependencies work fine. However, it looks like any other type of dependency won't.

I think that the problem is in the "externalDependencies()" method in sbteclipse-core/src/main/scala/com/typesafe/sbteclipse/core/Eclipse.scala. This function is called twice - once for the "compile" configuration and once for the "test" configuration. Libraries defined in those configurations have their sources linked fine (well, I didn't try the "test" configuration, but, I suspect it works). I'm guessing that the problem is either that this function should be called for more configurations or that they way its looking up the source dependencies isn't quite correct since its trying to look them up in the "compile" or "test" configuration, but the sources aren't available in those configurations (I guess that could also be a bug in core sbt or ivy, although, I don't know sbt internals well enough to know if it is).

A sample project that demonstrates this issue: https://github.com/DaGenix/eclipse-sources-provided-problem.git

Centaur commented Sep 14, 2013

Yes. So are the "provided" project dependencies.


hseeberger commented Oct 17, 2013

Have you tried to add Provided to the configurations setting? See the Wiki: https://github.com/typesafehub/sbteclipse/wiki/Using-sbteclipse

elyast commented Sep 5, 2014

I did try this one with sbteclipse 2.5.0 like this in build.sbt:

EclipseKeys.configurations := Set(Compile, Test, Provided)

and the following result:

[error] Could not create Eclipse project files:
[error] Undefined setting 'unmanagedSourceDirectories'!
[error] Undefined setting 'classDirectory'!
[error] Undefined task 'externalDependencyClasspath' for 'spark_test_project'!

is there any update on this bug? I'm also facing the problem of having provided source dependences not attached to Eclipse classpath. If I set EclipseKeys.configurations := Set(Compile, Test, Provided) to my buid.sbt I get the same error that elyast mentioned above. I'm using sbteclipse 3.0.0

elyast commented Jun 10, 2015

@estebandonato Similar story for 4.0.0-RC2

[error] Could not create Eclipse project files:
[error] Undefined setting 'unmanagedSourceDirectories'!
[error] Undefined setting 'unmanagedResourceDirectories'!
[error] Undefined setting 'managedSourceDirectories'!
[error] Undefined setting 'managedResourceDirectories'!
[error] Undefined task 'externalDependencyClasspath' for 'xxx'!

cretz commented Jul 20, 2015

I also get this error, and not with provided but when using IntegrationTest configuration in a global way when some specific SBT projects I have don't use IntegrationTest config.

dnwe commented Feb 15, 2016

It seems the only workaround for this is to manually remove % provided locally whilst developing, so that sbt eclipse adds the sourcepath values to the .classpath

diegonc commented Feb 15, 2017 edited

Same problem here; sources for provided dependencies are not attached.
Even with the following lines in ~/.sbt/build.sbt:

EclipseKeys.withSource := true
EclipseKeys.configurations := Set(Compile, Test, Provided)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment