简体   繁体   中英

Gradle dependencies of local dependency

So let's say I have project A, which requires certain dependencies. And I have project B, which has project A as one of its dependencies. So I have the following code in project B's build.gradle:

project B's build.gradle:

dependencies {
    compile files("projectA_dir/build/libs/projectA.jar")
}

However, since Gradle does not include project A's dependencies in projectA.jar by default. I was wondering if there's a way to let project B successfully compile project A without creating a fatjar for project A.

The jar file doesn't contain the transitive dependencies and doesn't have a pom file which describes the dependencies used by the module.

It means that, if you are importing a jar file using compile files you have to specify the dependencies also in your project .

You should use a maven repository , private or public, to avoid the issue.
In this case, gradle downloads the dependencies using the pom file which will contains the dependencies list.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM