root root gradle build file ->A own gradle build file -> shared gradle build file for shared modules -> shared:domain -> shared:BThe publishMavenJavaPublicationToMavenLocal task is available on domain when the maven-publishing plugin has been defined using "from components.java" and there are no dependencies between projects.
If A defines its own build.gradle file and has a project dependency on domain then domain will no longer have the publishMavenJavaPublicationToMavenLocal task available.
If B has a project dependency on domain and A does not then the publishMavenJavaPublicationToMavenLocal task is still available.
Dependencies upon a module should not affect its publishability.
The minimal example project demonstrating this is available on github - https://github.com/piersy/Gradle2MavenPublishBug Thanks