Unique snapshot dependencies for project's own subproject in POM not declared

Suppose you have a library project named ‘foo’, which consists of two subprojects foo-core and foo-extensions, where foo-extensions declares a dependency on foo-core. Now foo’s version is set to 1.2.0-SNAPSHOT. Now, thanks to #1722, gradle will create unique snapshots when publishing the artifacts

  • foo-core:1.2.0-20200415.152313-5
  • foo-extensions-1.2.0-20200415.152313-5

However, inspecting the POM of foo-extensions shows that it uses the SNAPSHOT version 1.2.0-SNAPSHOT for its foo-core dependency:

<dependency>
  <groupId>org.example</groupId>
  <artifactId>foo-core</artifactId>
  <version>1.2.0-SNAPSHOT</version>
  <scope>compile</scope>
</dependency>

This leads to inconsistencies, as consumers of foo-extensions may not use the foo-core artifact that was build together with foo-extensions, but potentially an older one. Or even a newer one. In short, a non-deterministic non-unique snapshot version is used.

How can I make gradle to use the unique snapshot version in the POM dependencies to other subprojects of the same project?

The project in question is Smack, in case you want to look at the gradle configuration