Strange error when importing artifact that depends on a java-platform

I’ve got a java-library that I build that lives in a multi-module project(now, gradle 7.0.2). One of the other modules in that project is a platform. When I build that multi-module project, everything behaves normally. I can build my code and deployables. However, when I try to use that module, I get an error.

dependency block of java library that uses the platform module:

dependencies {
    api platform(project(":platform"))
    implementation platform(project(":platform"))
    testImplementation platform(project(":platform"))
    annotationProcessor platform(project(":platform"))
    testAnnotationProcessor platform(project(":platform"))
    implementation group: 'org.apache.logging.log4j', name: 'log4j-api'
    implementation group: 'org.apache.logging.log4j', name: 'log4j-core'
    testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', classifier: 'tests'

Here are the core bits of the platform module:

javaPlatform {
dependencies {
    api platform(org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES)
    api platform("com.typesafe.akka:akka-bom_${versions.ScalaBinary}:2.6.14")
    constraints {
        api group: 'org.scalatest', name: 'scalatest_2.13', version: '3.2.5'
        api group: 'com.typesafe.akka', name: 'akka-stream-testkit_2.13'
        api group: 'com.typesafe.akka', name: "akka-stream_${versions.ScalaBinary}"
        api group: 'com.typesafe.akka', name: "akka-stream-kafka_${versions.ScalaBinary}", version: versions.AkkaStreamKafka

The project that gives me errors is a Spring Boot(v2.2.0) executable Jar that’s being built by Gradle 6.9.

I’ve imported the java library produced by my multimodule build like so:


and when I build the jar
% ./gradlew jar

gives me the following error:

  • What went wrong:
    Execution failed for task ‘:compileJava’.

Could not resolve all files for configuration ‘:compileClasspath’.
Could not resolve com.corp.multiModule:platform:
Required by:
project : > com.corp.multiModule:common-lib:
java.lang.NullPointerException (no error message)

I can see the platform POM artifact in my repo, it’s obviously finding the common-lib module.

What am I doing wrong? Is there some sort of trick to importing (or exporting) a module that uses a java-platform module in this way? Thanks for any insights you can provide.

I ended up just using the new version catalog feature and it worked really well for this problem.