Not able to resolve BOM dependency included in a POM file

I’m working on Java Gradle plugin for packaging our application.

Currently I’m leveraging getProject().getConfigurations().getResolvedConfiguration().getResolvedArtifacts() to get a list of dependency artifacts (JAR).

In addition I’m using getProject().getDependencies().createArtifactResolutionQuery() .forComponents(componentIdentifier).withArtifacts(MavenModule.class, MavenPomArtifact.class) “RECURSIVELY” to get a list of POM’s that I need to include as well.

Issue

When the generated package is installed with an Application and run compile, I’m getting the following compilation error,

 > Could not parse POM /Users/myuser/mycompany/Center1001_Test1/repository/org/glassfish/jersey/inject/jersey-hk2/2.26/jersey-hk2-2.26.pom
          > Could not parse POM /Users/myuser/mycompany/Center1001_Test1/repository/org/glassfish/jersey/inject/project/2.26/project-2.26.pom
                   > Could not parse POM /Users/myuser/mycompany/Center1001_Test1/repository/org/glassfish/jersey/project/2.26/project-2.26.pom
                          > Could not find org.glassfish.hk2:hk2-bom:2.5.0-b42.

Looking into this, I saw there in one packaged POM’s (project-2.26.pom) which has a BOM dependency included as follows,
http://mvn.uinnova.cn/nexus/content/shadows/central-m1/org.glassfish.jersey/poms/project-2.26.pom

        <dependency>
            <groupId>org.glassfish.hk2</groupId>
            <artifactId>hk2-bom</artifactId>
            <version>${hk2.version}</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>

I tried running the gradle dependency command and I’m seeing following error,

 \--- gw.sdk:sdk-commons-granite:1.42.0
    |         +--- org.slf4j:slf4j-api:1.7.25 -> 1.7.21
    |         +--- gw.sdk:sdk-commons:1.42.0 (*)
    |         +--- org.glassfish.jersey.containers:jersey-container-servlet:2.26 FAILED
    |         +--- org.glassfish.jersey.inject:jersey-hk2:2.26 FAILED
    |         \--- org.glassfish.jersey.media:jersey-media-json-jackson:2.26 FAILED

I thought of parsing the POM file for 'dependencyManagement" with scope ‘import’ and using the createArtifactResolutionQuery to get the POM and include it with my package ( Similar to what I do with other POM’s). But unfortunately the version is parameterized ‘${hk2.version}’.

How could I resolve this dependency?

Any help is much appreciated.