Project not resolving dependency results using composite builds and "latest.integration" version unless first being published to a repository

I’m using the gradle-karaf-plugin to generate artifacts that are used in the Karaf OSGi environment. Regardless, the plugin is running into an issue when trying to retrieve a set of resolved dependencies. I’m using composite builds and additionally using the Ivy latest.integration and latest.release functionality for internal dependency versions. That combined with dependency locking gives the ability to easily keep internal dependencies up to date while make builds reproducible. The problem arises when I create a new module (a new included Gradle build). When the code below tries to build a set of ResolvedDependencyResult's, it fails to resolve version “latest.integration” from the included build unless that build has previously been published (it returns as an UnresolvedDependencyResult and fails).

Here is the code that is doing the resolving:

static void walkDeps(Configuration configuration,
                         ResolvedComponentResult root,
                         Set<ResolvedDependencyResult> alreadyKnownDependencies,
                         Closure closure) {
        root.dependencies.findAll {
            it instanceof ResolvedDependencyResult
        }.collect {
            (ResolvedDependencyResult) it
        }.each {
            def result = (ResolvedDependencyResult) it
            if (!alreadyKnownDependencies.contains(result)) {
                walkDeps(configuration, result.selected, alreadyKnownDependencies, closure)

        closure(configuration, root)

This code is run after the project is evaluated.

Basically, here is the setup:

Composite parent project (includes some additional modules that may or may not depend on one another)
|–Module B (depends on nothing, has never been published to a Maven repository)
|–Module C (depends on module B and requests version “latest.integration” of Module B)

In the code snippet above, Module C will fail to get a ResolvedDependencyResult for Module B. I would expect Gradle to resolve the “latest.integration” version to the included build project, regardless of whether its been previously published.

I appreciate help with this!

Also, I tried Gradle 4.9 as it had some bug fixes in it but it still didn’t work.