title: gradle - why is this a dependency conflict or how to solve it?
body: <p>Gradle reports a dependency conflict while I thought that I can resolve conflicts by forcing a particular version. Can someone please shed a light on this and how to force a particular version in any case?</p>
  
  <p>This is the basic build script. It should work out of the box.</p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>apply plugin: 'java'
  
  ext {
      version_spring          = "4.0.4.RELEASE"
      version_jbehave         = "3.9.2"
  }
  
  repositories {
      mavenCentral()
  }
  
  configurations.all {
     resolutionStrategy {
        failOnVersionConflict()      ;; (1)
           //
           // The idea is to force a particular version of Spring
           //
           force "org:springframework:spring-core:${version_spring}"
           force "org.springframework:spring-test:${version_spring}"
     }
  }
  
  dependencies {
     // Transitivily depending on org.springframework:spring-test:3.1.1.RELEASE
     // Conflict is not resolved according to Gradle (see below) 
     compile "org.jbehave:jbehave-spring:${version_jbehave}"  
  }
  </code></pre>
  
  <p>Essentially I'm calling just "gradle dependencies". However, I'm throwing in various options to ensure that I'm not tricked by any cache.</p>
  
  <pre>
  $ gradle --no-daemon --cache rebuild --recompile-scripts \\
      --refresh-dependencies --rerun-tasks dependencies 
  :dependencies
  [..]
  FAILURE: Build failed with an exception.
  
  * What went wrong:
  Execution failed for task ':dependencies'.
  > Could not resolve all dependencies for configuration ':compile'.
     > A conflict was found between the following modules:
        - org.springframework:spring-core:3.1.1.RELEASE
        - org.springframework:spring-core:4.0.4.RELEASE
  
  * Try:
  Run with --stacktrace option to get the stack trace. Run with --info or --debug 
          option to get more log output.
  [..]
  </pre>
  
  <p>I'm using the latest version of Gradle:</p>
  
  <pre>
  $ gradle -v
  
  ------------------------------------------------------------
  Gradle 1.12
  ------------------------------------------------------------
  
  Build time:   2014-04-29 09:24:31 UTC
  Build number: none
  Revision:     a831fa866d46cbee94e61a09af15f9dd95987421
  
  Groovy:       1.8.6
  Ant:          Apache Ant(TM) version 1.9.3 compiled on December 23 2013
  Ivy:          2.2.0
  JVM:          1.8.0 (Oracle Corporation 25.0-b70)
  OS:           Mac OS X 10.8.5 x86_64
  </pre>