Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle adding compile dependencies to Proguard libraryjars

I'm trying to add compile dependencies(B.jar and C.jar) to proguard libraryjars.

Running:

println configurations.compile.collect()

I get:

[../B.jar, ../C.jar]

Here's what I've attempted:

task proguard(type: proguard.gradle.ProGuardTask) {
    ...
    libraryjars "${configurations.compile.collect()}"
    ...
}

For reference, the following works:

task proguard(type: proguard.gradle.ProGuardTask) {
    ...
    libraryjars "../B.jar"
    libraryjars "../C.jar"
    ...
}

This is obviously and example and my real projects has many dependencies. Any ideas?

like image 801
Christophe B Avatar asked Dec 14 '15 21:12

Christophe B


2 Answers

Ah, it was as simple as:

libraryjars files(configurations.compile.collect())
like image 148
Christophe B Avatar answered Jan 04 '23 05:01

Christophe B


Since Gradle 3.4+ with the deprecation of "compile" in favor of "implementation" (as described here) this worked:

libraryjars configurations.findByName('runtimeClasspath').getFiles()
like image 42
javajon Avatar answered Jan 04 '23 04:01

javajon