Composite builds and shadowJar

I have a build that use ShadowJar to do some relocations and then that Jar is the one that gets published to a Maven repository.

configure<PublishingExtension> {
    publications {
        create<MavenPublication>("mavenJava") {
            project.shadow.component(this)
            artifact(tasks["sourcesJar"])
            artifact(tasks["javadocJar"])
        }
    }
}

I then tried to include this project into another one via composite builds, but it does not find any of the relocations. I can see why this will not happen by default as the classes of the invluded build will be looked up inside build/classes/main.

Is there any way to configure this behaviour so that is would rather pull the artifact JAR in?

P.S. I am acutely aware that the publication section has nothing to do with composite builds, but I posted it because I think it provides more clarity in terms of the artifacts of the project.