Jar task does not seem to apply fileMode property?


(Nick S) #1

The Jar task has a documented fileMode property which when I use it seems not to do anything:

jar {

// We’re making a runnable jar

fileMode = 0755

// …

}

I’m using gradle 1.9. I see there was a similar bug fixed on the Copy task in version 1.0 (GRADLE-971). Is this a bug or by design?

Thanks


(Peter Niederwieser) #2

How do you tell that it’s not doing anything? Are you aware that this is supposed to set file permissions for the files inside the Jar?


(Nick S) #3

Ah, I see. From the documentation’s use of “target files” I expected it to make the jar executable; now I see the reason for the plural “files” and the symmetry with Copy tasks.

An explicit doLast { file(jar.archivePath).setExecutable(true, false) } is the way to do this, I guess?


(Peter Niederwieser) #4

Yes, that should do it.