Kotlin java-library module included into composite build loses its dependencies


I am using Gradle 5.2 with a multi-module composite build, and I am trying to include one of the composed modules as a testImplementation dependency. However, while Gradle successfully adds the modules’ own classes to the test classpath, it fails also to include all of the module’s transitive dependencies! The reason for this appears to be that the composed module (which happens to be written in Kotlin) applies the java-library plugin. Removing the java-library plugin from the composed module restores its transitive dependencies.

This does appear to be a Gradle bug - but does anyone know of a workaround please?