Abhijit Sarkar
Abhijit Sarkar

Reputation: 24518

Gradle project vs module dependency?

I'm familiar with compile project(':A') syntax where one submodule of a multi-module project declares a compile dependency on another submodule. Recently I came across compile module(':A') (sorry, don't have the reference). How's the 2nd one different from the 1st?

Upvotes: 3

Views: 1914

Answers (1)

Jared Burrows
Jared Burrows

Reputation: 55517

Straight from the docs:

23.4.2. Client module dependencies

Client module dependencies allow you to declare transitive dependencies directly in the build script. They are a replacement for a module descriptor in an external repository.

Example 23.8. Client module dependencies - transitive dependencies

build.gradle
dependencies {
    runtime module("org.codehaus.groovy:groovy:2.4.4") {
        dependency("commons-cli:commons-cli:1.0") {
            transitive = false
        }
        module(group: 'org.apache.ant', name: 'ant', version: '1.9.6') {
            dependencies "org.apache.ant:ant-launcher:1.9.6@jar",
                         "org.apache.ant:ant-junit:1.9.6"
        }
    }
}

See the documentation here: https://docs.gradle.org/current/userguide/userguide_single.html#sub:client_module_dependencies

Upvotes: 2

Related Questions