I am trying to merge multiple modules of my android library into one single block of implementation. eg
I have 3 modules which when uploaded to Maven gives 3 implementation blocks:
implementation 'com.example.sdk:core:1.0.2'
implementation 'com.example.sdk:feature1:1.0.2'
implementation 'com.example.sdk:feature2:1.0.2'
but I want to merge them into a single one like: implementation 'com.example.sdk:android-sdk:1.0.2'
So that users who want all, core and features can implement using a simple implementation line instead of multiple. Can this be possible?
I am using these classpaths in my main project:
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.18.0'
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.10.2'
Inside every library module adding a new gradle.properties file and adding the following segment of code in that:
GROUP=com.example.sdk
POM_ARTIFACT_ID=core
VERSION_NAME=1.0.2
POM_NAME=core
POM_PACKAGING=aar
POM_DESCRIPTION=Test for multi-module lib
POM_INCEPTION_YEAR=2021
POM_URL=GITHUB_URL
POM_SCM_URL= GITHUB_URL
POM_SCM_CONNECTION= GITHUB_URL.git
POM_SCM_DEV_CONNECTION=scm:git@GITHUB_URL
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
and pushing to maven with ./gradlew publish --no-daemon --no-parallel
Please let me know if any more information is required.
Try create a file named ./folder-deps/my-core.gradle
with content bellow:
dependencies{
implementation 'com.example.sdk:core:1.0.2'
implementation 'com.example.sdk:feature1:1.0.2'
implementation 'com.example.sdk:feature2:1.0.2'
}
In all build.gradle
import your module from file my-core.gradle
:
apply from: "$rootDir/folder-deps/my-core.gradle"
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.