Include dependency of project type in published artifact

I have a project that has multiple modules and one of these modules is publishing artifact to our internal artifactory.

Module that publishes the artifact dependends on other modules within same project structure:

dependencies {
    implementation project(":module1")
    implementation project(":module2")
    implementation project(":module3")
    implementation project(":module4")
    implementation project(":module5")

  //other androidx dependencies
}

We have pretty trivial setup for the publishing:

task androidSourcesJar(type: Jar) {
    archiveClassifier.set('sources')
    if (project.plugins.findPlugin("com.android.library")) {
        // For Android libraries
        from android.sourceSets.main.java.srcDirs
        from android.sourceSets.main.kotlin.srcDirs
    } else {
        // For pure Kotlin libraries, in case you have them
        from sourceSets.main.java.srcDirs
        from sourceSets.main.kotlin.srcDirs
    }
}

artifacts {
    archives androidSourcesJar
}

afterEvaluate {

    publishing {
        publications {

            mySdk(MavenPublication) {
                artifactId = 'my-sdk'
                artifact(androidSourcesJar)
                groupId = 'com.my.sdk.android'
                def versionMajor = 0
                def versionMinor = 1
                def versionPatch = 0
                def versionBuild = System.getenv("AZURE_BUILD_NUMBER") ?: "1"
                def isSnapshot = System.getenv("SOURCE_BRANCH_NAME") == "development"
                def suffix = isSnapshot ? "-SNAPSHOT-$versionBuild" : ""
                version = "$versionMajor.$versionMinor.$versionPatch$suffix"

                if (project.plugins.findPlugin("com.android.library")) {
                    from components.release
                } else {
                    from components.java
                }
            }
        }
        repositories {
            maven {
                def isSnapshot = System.getenv("SOURCE_BRANCH_NAME") == "development"
                System.out.println("Source Branch Name " + System.getenv("SOURCE_BRANCH_NAME") + ", isSnapshot " + isSnapshot)

                def releaseRepoUrl = "https://..../maven-gradle-release-local"
                def snapshotRepoUrl = "https://.../maven-gradle-snapshot-local"
                setUrl(isSnapshot ? snapshotRepoUrl : releaseRepoUrl)
                credentials {
                    username = findProperty("artifactoryUser").toString()
                    password = findProperty("artifactoryPassword").toString()
                }
            }
        }
    }
}

The artifact is publish, but classes coming from the project dependencies (module1, module2 etc) are not visible to the consumer of the artifact.

How can I include classes from project dependencies in the artifact? How can I select which sources to include or exclude?

I want to include project() dependencies but not androidx.