Transitive dependency selected by rule

Hi,

I have a muti-module gradle project with one of the child project having following dependencies:

compile("org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1")
compile ("org.elasticsearch:elasticsearch:6.3.1")

Following is the output of dependencyInsight

org.elasticsearch:elasticsearch:5.6.10 (selected by rule)

org.elasticsearch:elasticsearch:6.3.1 -> 5.6.10
+--- project :infrastructure:persistence
|    +--- compile
|    \--- project :infrastructure:messaging
|         \--- compile
\--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1
     \--- project :infrastructure:persistence (*)

org.elasticsearch:jna:4.4.0-1
\--- org.elasticsearch:elasticsearch:5.6.10
     +--- project :infrastructure:persistence
     |    +--- compile
     |    \--- project :infrastructure:messaging
     |         \--- compile
     \--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1
          \--- project :infrastructure:persistence (*)

org.elasticsearch:securesm:1.2
\--- org.elasticsearch:elasticsearch:5.6.10
     +--- project :infrastructure:persistence
     |    +--- compile
     |    \--- project :infrastructure:messaging
     |         \--- compile
     \--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1
          \--- project :infrastructure:persistence (*)

org.elasticsearch.client:elasticsearch-rest-client:6.3.1
\--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1
     \--- project :infrastructure:persistence
          +--- compile
          \--- project :infrastructure:messaging
               \--- compile

org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1
\--- project :infrastructure:persistence
     +--- compile
     \--- project :infrastructure:messaging
          \--- compile

org.elasticsearch.plugin:aggs-matrix-stats-client:6.3.1
\--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1
     \--- project :infrastructure:persistence
          +--- compile
          \--- project :infrastructure:messaging
               \--- compile

org.elasticsearch.plugin:parent-join-client:6.3.1
\--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1
     \--- project :infrastructure:persistence
          +--- compile
          \--- project :infrastructure:messaging
               \--- compile

org.elasticsearch.plugin:rank-eval-client:6.3.1
\--- org.elasticsearch.client:elasticsearch-rest-high-level-client:6.3.1
     \--- project :infrastructure:persistence
          +--- compile
          \--- project :infrastructure:messaging
               \--- compile

I am struggling to undestand why a old version of org.elasticsearch:elasticsearch is getting selected even though I have explicitly specified the latest version. How can I force selection of dependency with version 6.3.1?

Note: I am using spring dependency management as well.

I tried following but still same problem is exists.

compile("org.elasticsearch:jna:4.4.0-1") {
        exclude group: "org.elasticsearch", module: "elasticsearch"
    }
    compile("org.elasticsearch:securesm:1.2") {
        exclude group: "org.elasticsearch", module: "elasticsearch"
    }

Also noticed that he problem goes away when I move those dependencies to the root project but I would like to keep them inside the child project. Please help, thanks in advance.

1 Like

Just for the record I was able to solve this problem by removing spring dependency management plugin.

1 Like