Preventing repeat download of scala-compiler JAR inside Gradle

I have a build.gradle that starts like this:

apply plugin: ‘java’
apply plugin: ‘scala’

When I run it inside Docker (in CI), it spends about a minute downloading jars (e.g. the scala compiler jar). Every time I change the source code and rebuild in Docker, the files are downloaded again. To speed this up, I’ve copied the snippet above and added

task download() {}

Calling gradle download (in a Dockerfile layer) grabs some JARs, but not the scala compiler JARs. I’d be grateful for any suggestion of how I could force those to download.

thanks,
Mohan