I intend to publish my modules in a nexus repository with the following steps.
first step:
Create a android-publications.gradle file and add the following contents to it
android-publications.gradle :
apply plugin: 'maven-publish'
ext.moduleVersion = "0.0.0"
def moduleGroupId = "team.techvida.framework"
def moduleRepoUrl = "http://url/repository/maven-releases/"
afterEvaluate {
    publishing {
        publications {
            debug(MavenPublication) {
                from components.debug
                groupId = moduleGroupId
                artifactId = "$project.name-debug"
                version = moduleVersion
            }
            release(MavenPublication) {
                from components.release
                groupId = moduleGroupId
                artifactId = project.name
                version = moduleVersion
            }
        }
        repositories {
            maven {
                name "nexus"
                url moduleRepoUrl
                allowInsecureProtocol = true
                credentials {
                    username findProperty("nexusUsername")
                    password findProperty("nexusPassword")
                }
            }
        }
    }
}
Step two Use it in all modules as follows:
core module =>
apply from: "$rootDir/android-library-build.gradle"
apply from: "$rootDir/buildSrc/android-publications.gradle"
ext.moduleVersion = "0.0.1"
dependencies {
}
presentation module =>
apply from: "$rootDir/android-library-build.gradle"
apply from: "$rootDir/buildSrc/android-publications.gradle"
ext.moduleVersion = "0.0.1"
dependencies {
}
Third step Use in a module that uses other modules
di module =>
apply from: "$rootDir/android-library-build.gradle"
apply from: "$rootDir/buildSrc/android-publications.gradle"
ext.moduleVersion = "0.0.1"
dependencies {
    implementation(project(Modules.core))
    implementation(project(Modules.imageLoading))
    implementation(project(Modules.prettyLogger))
}
Note 1 : Publishing the second step modules is done successfully.
Step 4 (which leads to a compilation error) Publish the third step module (di)
Received error:
 What went wrong:
Could not determine the dependencies of task ':di:publishReleasePublicationToNexusRepository'.
> Publishing is not able to resolve a dependency on a project with multiple publications that have different coordi
nates.
  Found the following publications in project ':image_loading':
    - Maven publication 'debug' with coordinates team.techvida.framework:image_loading-debug:0.0.1
    - Maven publication 'release' with coordinates team.techvida.framework:image_loading:0.0.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run
with --scan to get full insights.
Would you please tell me how to solve this problem?