`gradle test` re-downloading dependencies

gradle

#1

Hello,

I have project using Spring Boot and Gradle. Logs from gradle dependencies show that everything has already been downloaded and cached. However, gradle test re-downloads many of the dependencies. Is there any way to fix this?

Here’s my build.gradle:

buildscript {
    repositories {
        jcenter()
        maven { url "http://repo.spring.io/snapshot" }
        maven { url "http://repo.spring.io/release" }
    }

    dependencies {
        classpath "org.jooq:jooq-codegen:3.7.2"
        classpath "mysql:mysql-connector-java:5.1.38"
        classpath "org.springframework.boot:spring-boot-gradle-plugin:1.3.1.RELEASE"
    }
}

apply plugin: "java"
apply plugin: "spring-boot"

sourceSets {
    main {
        java {
            srcDir "src/main/java"
            srcDir "src/gen/java"
        }
    }

    jooq {
        java {
            srcDir "src/jooq/java"
        }
    }
}

repositories {
    jcenter()
    maven { url "http://repo.spring.io/snapshot" }
    maven { url "http://repo.spring.io/release" }
}

dependencies {
    compile "org.springframework.boot:spring-boot-starter-web:1.3.1.RELEASE"
    compile "org.springframework.boot:spring-boot-starter-validation:1.3.1.RELEASE"
    compile "org.springframework.boot:spring-boot-starter-security:1.3.1.RELEASE"
    compile "org.springframework.boot:spring-boot-starter-actuator:1.3.1.RELEASE"
    compile "org.springframework.boot:spring-boot-devtools:1.3.1.RELEASE"
    compile "org.springframework.boot:spring-boot-starter-data-mongodb:1.3.1.RELEASE"

    compile "org.jooq:jooq:3.7.2"
    compile "com.aol.simplereact:simple-react:0.99.6"
    compile "mysql:mysql-connector-java:5.1.38"
    compile "javax.persistence:persistence-api:1.0.2"
    compile "org.springframework:spring-jdbc"
    compile "org.springframework:spring-tx"
    compile "com.zaxxer:HikariCP:2.4.3"
    compile "org.slf4j:slf4j-api:1.7.13"

    testCompile "org.springframework.boot:spring-boot-starter-test:1.3.1.RELEASE"
    testCompile "com.h2database:h2"

    jooqCompile "org.jooq:jooq-codegen:3.7.2"
    compile "org.jooq:jooq-codegen:3.7.2"
}

task jooq(type: JavaExec) {
    main = "org.jooq.util.GenerationTool"
    classpath = buildscript.configurations.classpath + sourceSets.jooq.runtimeClasspath
    args "src/jooq/resources/jooq.xml"
}

and circle.yml:

machine:
  java:
    version: oraclejdk8
  services:
    - docker

dependencies:
  override:
    - gradle dependencies

test:
  override:
    - gradle test
  post:
    - mkdir -p $CIRCLE_TEST_REPORTS/junit/
    - find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;

deployment:
  # omitted

Gradle build phase
#2