dave08
12/30/2021, 12:56 PM:common
some-android-lib
depends on :common
and android-app
depends on some-android-lib
, I want to only publish some-android-lib
to maven and include :common
in it, and then only refer to some-android-lib
in android-app
...ephemient
12/30/2021, 1:05 PMgroupId:some-android-lib
which will transitively pull in groupId:common
without the consumer needing to explicitly mention itdave08
12/30/2021, 1:09 PMimplementation(project(":some-android-lib"))
... I can't do that here in any way?
I'm trying to avoid all the mess in publication configuration and versioning of these modules...Vampire
12/30/2021, 1:15 PMdave08
12/30/2021, 1:18 PMephemient
12/30/2021, 1:18 PMimplementation("groupId:some-android-lib:version")
should work in an external project just like implementation(":some-android-lib")
in an internal Gradle projectephemient
12/30/2021, 1:21 PMproject.version
in every project, but it's possible to set that (and group
) by gradle properties, you don't need a plugin unless you want more logic to itdave08
12/30/2021, 1:30 PMgroupId
would get resolved if I have an app
dir with the application with the gradle root, and another some-lib
dir with the lib and it's own gradle root... how would gradle know to pull from`some-lib` to compile it with the app without any publications?
Originally I separated the lib out of the main project because the main project was managed by another developer, and I was managing the library... but now I have to manage both, and I already have two separate git repos and versioning for each.
I actually didn't mind publishing the lib, but when I split it into a few modules, I started getting into this problem.dave08
12/30/2021, 1:31 PMephemient
12/30/2021, 1:34 PMdave08
12/30/2021, 1:35 PMephemient
12/30/2021, 1:35 PMephemient
12/30/2021, 1:36 PMdave08
12/30/2021, 1:37 PMdave08
12/30/2021, 1:37 PMincludedBuild?
Vampire
12/30/2021, 1:37 PMephemient
12/30/2021, 1:37 PMephemient
12/30/2021, 1:37 PMephemient
12/30/2021, 1:38 PMephemient
12/30/2021, 1:40 PMdave08
12/30/2021, 1:43 PMdave08
12/30/2021, 1:44 PMdave08
12/30/2021, 1:45 PMephemient
12/30/2021, 1:46 PMlib-repo/some-android-lib/build.gradle # group = groupId, name = some-android-lib, version = 1.0
dependencies { implementation(project(":common")) }
lib-repo/common/build.gradle # group = groupId, name = common, version = 1.0
when you publish this to Maven, you should have groupId:some-android-lib:1.0
with metadata that indicates that it also depends on groupId:common:1.0
Vampire
12/30/2021, 1:47 PMephemient
12/30/2021, 1:48 PMdave08
12/30/2021, 1:52 PMVampire
12/30/2021, 1:53 PMVampire
12/30/2021, 1:53 PMVampire
12/30/2021, 1:53 PMdave08
12/30/2021, 1:54 PMapi(":common")
in the lib, the code just isn't in the lib's aar...ephemient
12/30/2021, 1:55 PMVampire
12/30/2021, 1:55 PMVampire
12/30/2021, 1:55 PMdave08
12/30/2021, 1:55 PMephemient
12/30/2021, 1:55 PMapp-repo/app/build.gradle
dependencies { implementation("groupId:some-android-lib:1.0") }
if you use ./gradlew --include-build=../lib-repo
then groupId:some-android-lib
will be resolved from the included build, and otherwise it'll be resolved from mavenephemient
12/30/2021, 1:56 PMephemient
12/30/2021, 1:56 PMephemient
12/30/2021, 1:57 PMdave08
12/30/2021, 2:03 PM--include-build=../lib-repo
straight in the gradle script or in a way Android Studio will do that on a dev build?ephemient
12/30/2021, 2:04 PMsettings.gradle
, see the docsVampire
12/30/2021, 2:05 PMephemient
12/30/2021, 2:05 PMephemient
12/30/2021, 2:07 PMdave08
12/30/2021, 2:16 PMdave08
12/30/2021, 2:41 PMenableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
doesn't work with composite builds...ephemient
12/30/2021, 2:45 PMgroup:module:version
. putting that in a version catalog should workdave08
12/30/2021, 2:46 PMephemient
12/30/2021, 2:46 PMephemient
12/30/2021, 2:46 PMephemient
12/30/2021, 2:48 PMdave08
12/30/2021, 2:48 PMandroid { ... }
block, outside it, or maybe in the root build.gradle.kts?... I'm really not so familiar with the more advanced gradle setups...ephemient
12/30/2021, 2:48 PMdave08
12/30/2021, 2:49 PMimplementation(":lib-folder-name:module-name")
but it didn't find it...dave08
12/30/2021, 2:50 PMephemient
12/30/2021, 2:52 PM:
and it's more likely to be module-parent:module-name
or undefined:module-name
, depending on the path structureephemient
12/30/2021, 2:52 PMsettings.gradle
)ephemient
12/30/2021, 2:53 PMdave08
12/30/2021, 2:55 PMcreate<MavenPublication>("release") {
from (components["release"])
// You can then customize attributes of the publication as shown below.
groupId = "some-lib-group"
artifactId = "some-lib"
version = currLibVersion
}
dave08
12/30/2021, 2:55 PMephemient
12/30/2021, 2:56 PMephemient
12/30/2021, 2:56 PMdave08
12/30/2021, 3:06 PMephemient
12/30/2021, 3:07 PMdave08
12/30/2021, 3:11 PMephemient
12/30/2021, 3:18 PMephemient
12/30/2021, 3:19 PM./gradlew app:dependencies
should show something like some-lib-group:some-lib -> project :some-lib
dave08
12/30/2021, 4:38 PMincludeBuild
in pluginManagement
like it said in the docs... but in the sample I noticed it was outside of it... so I put it outside and it seems like now it's compiling finally... I just wonder the difference between the two, and how the other one works... the docs are not so clear.Vampire
12/30/2021, 4:53 PMpluginManagement
is when you are building a Gradle plugin in the included build that you want to use in your build.
Outside the pluginManagement
is when you are building a dependency of your project in the included build like in your case.dave08
12/30/2021, 4:57 PMVampire
12/30/2021, 11:16 PM