St.Antario
St.Antario

Reputation: 27375

Why doesn't gradle return dependencies for another projects?

I have the following build script (webapp:build.gradle):

apply plugin: 'java'

dependencies {
    project(':api')
}

When I run gradle dependencies webapp:dependencies in command line I get:

:dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

No configurations
:webapp:dependencies

------------------------------------------------------------
Project :webapp
------------------------------------------------------------

archives - Configuration for archive artifacts.
No dependencies

compile - Compile classpath for source set 'main'.
No dependencies

default - Configuration for default artifacts.
No dependencies

runtime - Runtime classpath for source set 'main'.
No dependencies

testCompile - Compile classpath for source set 'test'.
No dependencies

testRuntime - Runtime classpath for source set 'test'.
No dependencies

There was nothing to be said about dependency from api project. Why? What's wrong?

Upvotes: 1

Views: 198

Answers (1)

Opal
Opal

Reputation: 84756

Because You haven't specified configuration name for this dependency. It should be e.g.:

dependencies {
   compile project(':api')
}

webapp/build.gradle

apply plugin: 'java'

dependencies {
    compile project(':api')
}

webapp/settings.gradle

include 'api'

webapp/api/build.gradle

apply plugin: 'java'

Upvotes: 1

Related Questions