jeff
jeff

Reputation: 1098

Can I include a local module in my published aar library?

I am working on a project with a few modules, something like this:

:app
:coreLib
:exportLibrary
:otherLibrary

in my build.gradle for my exportLibrary module I import coreLib like this: implementation(project("coreLib"))

and in my app I do the same to include exportLibrary: implementation(project("exportLibrary"))

What I want to do is publish exportLibrary to a maven repository, and I want it to include everything from coreLib. I haven't found a good way to do this yet. Adding a transitive flag does not help. What am I missing?

I hope I do not need to publish coreLib too!

I am publishing using artifactoryPublish, which includes the artifacts created after running assembleRelease. So, basically how do I make assembleRelease produce a binary that includes my local dependency?

Upvotes: 3

Views: 378

Answers (1)

Gabriele Mariotti
Gabriele Mariotti

Reputation: 364211

Just publish coreLibrary in the maven repo.

Then in your exportLibrary change the dependency with:

implementation "com.xxxx.coreLibrary:x.y.z"

and publish it in the maven.
At this point if you check the pom file of exportLibrary in the repo you will find the dependency to com.xxxx.coreLibrary:x.y.z.

Upvotes: 1

Related Questions