Download the dependencies into a specific folder

Hi all,

I have a gradle project in eclipse and all external jars are downloaded in the root directory of the project. I am wondering if there is a way to download all the jars by default in to a specific directory

I have added the following entries in my gradle.build file, but it doesn’t work:

task copyToLib(type: Copy) {
into "$buildDir/output/lib"
from configurations.runtime
}
build.dependsOn copyToLib

By performing “gradle refresh all” in eclipse, I still getting all my external libraries in the root folder of my project. Am I missing anything?

Regards
S.

Are you using the STS Gradle plugin, or Buildship ?

Why do you really need your dependencies in the project folder ?
Best practice is that the .classpath file is generated (by buildship / the gradle eclipse plugin / sth else) and points to wherever the dependencies are downloaded (in the gradle cache)

I am using https://github.com/spring-projects/eclipse-integration-gradle

I don’t need my dependencies in the project folder, but gradle download them automatically when I perform “gradle -> refresh all” (Have a look please on the attached screenshot)


I would prefer to have a good organized project, and not so many jars (screenshot), therefore I asked about uploading the files into a folder.

I will have to read about that feature that you wrote (generation of the classpath) because I didn’t know it. Please let me know if you have suggestions.

Thanks a lot Francois,
S.

Your dependencies are organized: they are located in /home/merlin/.gradle/caches/

The fact that you see them like that is Eclipse related. They shall be displayed under a “referenced library” section within your eclipse project.

Ps: You might want to take a look at buildship.

Thanks Francois, I will have a look into buildship