We have a Maven core extension (https://search.maven.org/artifact/com.gradle/gradle-enterprise-maven-extension/1.5/jar) that declares two packages as exported in its META-INF/maven/extension.xml:
The first package (com.gradle.maven.extension.api.scan) contains a BuildScanApi interface for which the extension registers a component in an EventSpy at runtime.
We would now like to consume that component in another core extension (let's call it consuming-extension) that has a provided dependency to com.gradle:gradle-enterprise-maven-extension like this:
However, whether that works depends on how the core extensions are registered. Relevant for us are the following registration locations: <maven-home>/lib/ext, -Dmaven.ext.class.path, and .mvn/extensions.xml.
With this workaround, I was able to get it working in all cases:
Please let me know if I have misunderstood the intention of declaring exported packages in extension.xml. I was unable to find documentation on it, unfortunately.