Take the 2-minute tour ×

I am depending on a few artifacts that I need to both compile and run my application.

According to the Gradle docs, the runtime configuration extends the compile configuration, so surely adding a dependency using runtime implies an implicit compile dependency?

At least that was my assumption, but it does not work. When just depending on the artifact using runtime, my project does not compile anymore. I literally have to:

compile 'oauth.signpost:signpost-core:'
runtime 'oauth.signpost:signpost-core:'

for the application to both compile and see the Signpost classes at runtime.

Am I missing something? That just doesn't look right...

share|improve this question

1 Answer 1

up vote 12 down vote accepted

Almost right. Runtime configuration, indeed, extends compile configuration. It means, that any dependency added to compile configuration is available in runtime configuration

compile 'oauth.signpost:signpost-core:' will be enough to get this artifact in both, runtime and compile.

share|improve this answer
I see -- how odd. Just trying to understand how this works then. Looking at gradle.org/0.9.1/docs/userguide/…, does that mean that any configuration in figure 20.2 is a combination of all the configurations that have inbound arrows to it? Thinking of 'extension' in the classic 'inheritance' kind of way, one would assume the opposite. –  Matthias Jan 15 '11 at 9:53
Oh and: is it correct to assume then that Gradle's 'runtime' configuration corresponds to Maven's 'provided' scope? –  Matthias Jan 15 '11 at 9:54
In the userguide diagram 20.2 any configuration is a combination of all the outbound paths, e.g. testRuntime includes everything from runtime and compile, beacuse outbound arrow shows that testRuntime extends runtime –  Nikita Skvortsov Jan 15 '11 at 11:44
That's what I was thinking, too, but by following that same logic, runtime would include the compile configuration, not vice versa. That's exactly the opposite from what you said in your answer! –  Matthias Jan 16 '11 at 10:37
Oh snap, I think I get it now. I think my mistake was that I was thinking of configurations as being "behavior" instead of being "sets". The word "extends" got me confused. Extending here actually means "superset-of". So if I add something to compile, then it will also be visible to anything relying on runtime, since it's a super-set of compile. Adding something only to runtime, will therefore not be visible to any task using the compile configuration. Does that make sense? –  Matthias Jan 16 '11 at 10:49

Your Answer


