Gradle JAR dependency inside library module

I am transferring a project with several Android modules from Ant to Gradle.
We have several jars in the repo in the libs directory of the library module.

The dependency is as follows:

AppModule is dependent on LibModule.

The code in the AppModule cannot access the contents of the jar library, which is located in LibModule.
Although it can access the LibModule classes from the source (proving that the dependency is generally installed).

Documentation

Gradle says that all dependencies are transitive by default, but this experience seems to invalidate such a requirement. Is this a mistake or is there some legal reason?

I managed to crack it by adding a workaround dependency in the AppModule:

compile fileTree(dir: '../LibModule/libs', include: ['*.jar']) // HACK! 

But there must be a more severe way to do this, right?

Gradle version: 2.1.

Interestingly, Android Studio seems to respect bank transitivity and does not signal an error.

An error occurs when I create using

 ./gradlew assembleDebug 

A typical java error is reported:

 error: package net.jcip.annotations does not exist import net.jcip.annotations.NotThreadSafe; ^ 

I know that I can also specify deps in the maven-ish style, but we would like to be able to work with jars-in-the-repo, as well as for our purposes.

TIA, Karol

+5
source share

Source: https://habr.com/ru/post/1208443/


All Articles