Gradle dependency caching

caching
gradle
java
2.0

#1

The 2.0 docs contains a section about how to setup Circle CI 2.0 for Maven projects:
https://circleci.com/docs/2.0/language-java/

Is there an example for Gradle as well? I’m mostly interested in how to implement caching of Gradle dependencies.


#2

Hello,

Great question! I am the “Java Language Owner” at CircleCI and have been working on making the Java experience on 2.0 A+.

AFAIK gradle does not have the equivalent of mvn dependency:go-offline so there is no great solution for caching everything.

I’ve looked through their docs but did not see anything that was very useful for our purposes.

Im still finishing up getting a lot of useful example apps, documentation, and convenience images made for Java projects. I started with Spring and Maven since they are the most popular on our platform, but will be covering gradle, sbt, and ant in the near future.


#3

@levlaz take a look at this SO answer for inspiration. I’ve used the following in dependencies overrides sections in Circle 1.0 in the past.

task downloadDependencies(type: Exec) {
    configurations.testRuntime.files
    commandLine 'echo', 'Downloaded all dependencies'
}

We were hoping a Gradle guide would be written too, and holding off a transition to 2.0 to have better guidance.


#4

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.