title: gradle force version of transitive dependency not working. No exclude, override or force seems to apply
body: <p>I have a conflict with a transitive dependency. Overriding, excluding or forcing does not help. What else can I do to get the right version of the library into the jar?
  The full code dan be. found <a href="https://github.com/geoHeil/gradle-dependency-resolution" rel="noreferrer">https://github.com/geoHeil/gradle-dependency-resolution</a> but the main parts of it are described below.</p>
  
  <h2>problem description</h2>
  
  <p>executing</p>
  
  <pre><code>./gradlew shadowJar
  </code></pre>
  
  <p>with geomesa dependencies (which pull in an outdated version of typesafe/lightbend configuration library) disabled:</p>
  
  <pre><code>dependencies {
  
      compile "com.github.kxbmap:configs_2.11:0.4.4"
      //compile "org.locationtech.geomesa:geomesa-hbase-spark-runtime_2.11:2.0.1"
  }
  </code></pre>
  
  <p>and executing the jar</p>
  
  <pre><code>java -jar build/libs/gradleThing-all.jar                         
  </code></pre>
  
  <p>outputs</p>
  
  <pre><code>hello
  my config is: Success(Job1Configuration(frequencyCounting))
  </code></pre>
  
  <p>When enabling the dependencies:</p>
  
  <pre><code>./gradlew shadowJar
  java -jar build/libs/gradleThing-all.jar                         
  </code></pre>
  
  <p>it fails with</p>
  
  <pre><code>hello
  Exception in thread "main" java.lang.Exception: Failed to start. There is a problem with the configuration: Vector([extract] com.typesafe.config.Config.hasPathOrNull(Ljava/lang/String;)Z)
  </code></pre>
  
  <p>which is related to an outdated version of the config library, <a href="https://stackoverflow.com/questions/40610816/how-to-resolve-nosuchmethoderror-on-typesafe-config">how to resolve NoSuchMethodError on typesafe config?</a>.
  Also confirmed via:</p>
  
  <pre><code>gradle dependencyInsight --dependency om.typesafe:config
  
  &gt; Task :dependencyInsight
  com.typesafe:config:1.3.1 (conflict resolution)
     variant "runtime" [
        Requested attributes not found in the selected variant:
           org.gradle.usage = java-api
     ]
  \--- com.github.kxbmap:configs_2.11:0.4.4
       \--- compileClasspath
  
  com.typesafe:config:1.2.1 -&gt; 1.3.1
     variant "runtime" [
        Requested attributes not found in the selected variant:
           org.gradle.usage = java-api
     ]
  +--- org.locationtech.geomesa:geomesa-convert-avro_2.11:2.0.1
  |    \--- org.locationtech.geomesa:geomesa-convert-all_2.11:2.0.1
  |         +--- org.locationtech.geomesa:geomesa-tools_2.11:2.0.1
  |         |    \--- org.locationtech.geomesa:geomesa-hbase-spark-runtime_2.11:2.0.1
  |         |         \--- compileClasspath
  ...
  </code></pre>
  
  <p>How can I fix the transitive dependency to my desired version of 1.3.3?</p>
  
  <h2>my solutions</h2>
  
  <p>Trying to set:</p>
  
  <pre><code>compile("org.locationtech.geomesa:geomesa-hbase-spark-runtime_2.11:2.0.1") {
                  exclude group: 'com.typesafe', module: 'config'
              }
  </code></pre>
  
  <p>and re running the jar fails again with the same issue.</p>
  
  <p>Also an constraint <a href="https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:dependency_constraints" rel="noreferrer">https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:dependency_constraints</a> like:</p>
  
  <pre><code>implementation("com.typesafe:config")
      constraints {
          implementation("com.typesafe:config:1.3.3") {
              because 'previous versions miss a method https://stackoverflow.com/questions/40610816/how-to-resolve-nosuchmethoderror-on-typesafe-config'
          }
      }
  </code></pre>
  
  <p>or using force <a href="https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:enforcing_dependency_version" rel="noreferrer">https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#sec:enforcing_dependency_version</a> like : </p>
  
  <pre><code>implementation('com.typesafe:config:1.3.3') {
          force = true
      }
  </code></pre>
  
  <p>or like:</p>
  
  <pre><code>configurations.all {
      resolutionStrategy {
          force 'com.typesafe:config:1.3.3'
      }
  }
  </code></pre>
  
  <p>does not give the right version.</p>
  
  <h2>result</h2>
  
  <p>All variants fail with the same error</p>
  
  <p>What is wrong? There must be a way to force the desired version.</p>