Trying to unpack the jars of two specific dependencies gives me an UP-TO-DATE

(Frigo Coder) #1


There are two dependencies with 3-3 jar files each, containing native .dll and .so libraries that I would like to extract to $buildDir/natives/. I made a simple Copy task to handle it.

However, for some reason, Gradle thinks the task is up to date, and refuses to do anything, even if I do an upToDateWhen false.

But, if I instead include a dependency that has the other two as transitive dependencies, suddenly it can extract them. It is commented out below:

apply plugin: 'java'
  repositories {
  configurations {
  dependencies {
    natives group: '', name: 'jinput-platform', version: 'latest.release'
    natives group: 'org.lwjgl.lwjgl', name: 'lwjgl-platform', version: 'latest.release'
  natives group: 'org.lwjgl.lwjgl', name: 'lwjgl', version: 'latest.release'
  task extractNatives (type: Copy, dependsOn: configurations.natives) {
    from configurations.natives.collect {

Am I overlooking something obvious or otherwise what is going on?

Thank you for your help!

(Peter Niederwieser) #2

One obvious problem is that you resolve the configuration in the configuration phase. To fix this, enclose the expression following ‘from’ in curly braces.

(Frigo Coder) #3

Have tried that too but found no change in behavior.

(Peter Niederwieser) #4

As can be seen on, all artifacts associated with these dependencies have classifiers. Hence you’ll have to use one of ‘classifier: ‘natives-osx’’, ‘classifier: ‘natives-windows’’, or ‘classifier: ‘natives-linux’’. Otherwise you’ll get back an empty set of artifacts.

A good way to find such problems is to print the resolved contents of a configuration:

task debug << {
  configurations.natives.each { println it }

(Frigo Coder) #5

Thank you, you just saved me from several days worth of headache!