Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is resolve dependencies 'classpath' so slow?

Tags:

java

gradle

Why do all my gradle tasks become really slow (longer than 5 minutes) when I add apache commons codec and apache commons io dependencies to my project? To be clear, executing the build task still works, but just takes a very long time. When it is slow, the gradle output is

resolving dependencies: 'classpath'

Below is the offending portion of my build.gradle:

buildscript {
  repositories {
    maven { url "http://repo.spring.io/libs-snapshot"  }
    mavenCentral()
    mavenLocal()
  }
  dependencies {
    classpath("org.springframework.boot:spring-boot-gradle-plugin:0.5.0.M6")
    classpath("org.mongodb:mongo-java-driver:2.11.3")
    classpath("org.seleniumhq.selenium:selenium-java:2.37.1")
    classpath("com.google.guava:guava:16.0.1")
    classpath('commons-codec:commons-codec:1.9')
    classpath("commons-io:commons-io:2.4")
  }
}

If I do not include the last two classpath dependencies (codec and io), the buildscript is much faster. I am using gradle 1.10 via gradlew.

like image 256
Joel Denning Avatar asked Nov 10 '22 11:11

Joel Denning


1 Answers

First question is do you really need to add all those dependencies to the Gradle script's classpath? Are these script plugin dependencies or your application's dependencies?

Your example looks quite different to the Spring Boot example. You are using a much older version of the Spring Boot Gradle plugin.

like image 100
SteveD Avatar answered Nov 14 '22 23:11

SteveD