Gradle and dependencies

(Charles Watson) #1

If I build a project that has an external dependency I can specify the repository and the dependency in the build.gradle file and on build the project builds successfully giving me a message ‘Downloading xxx.jar’ and producing compiled class files. If I then want to run the project I would need to specify the location of that downloaded jar with the -cp switch (java -cp mylib/xxx.jar package.mainclass) - where does gradle put the jars it downloads - they don’t seem to be anywhere on the system. Have I misunderstood what gradle is doing or how it should be used?

(jbisotti) #2

Look in ‘~/.gradle/caches’. Also, it’s pretty simple to write a task to copies all dependencies to some defined location. Finally, Gradle’s “application” plugin might be useful.

(Peter Niederwieser) #3


task printDeps << {
    configurations.compile.each { println it }

(Charles Watson) #4

Got it - thanks.