Output files resolution with 2.4

Hi,

I’m using OneJar plugin (https://github.com/rholder/gradle-one-jar) and I observed a different behavior with Gradle 2.4. At some point in my build I used the output files of the OneJar task and I expect to find a single file there (the generated standalone Jar). With Gradle 2.4 I observed that 2 files are in oneJarTask.outputs.files whereas in 2.3 there was only one file.

The new file is called standalone.jar suggesting it has been added only taking into account the classifier. I created a test project to illustrate the problem here https://github.com/youribonnaffe/gradle-one-jar-2.4.

If you run gradle print, it will print the output files of the OneJar task. The printDebug task shows where the standalone.jar is coming from. From the constructor of OneJar ( https://github.com/rholder/gradle-one-jar/blob/master/src/main/groovy/com/github/rholder/gradle/task/OneJar.groovy#L72 ). The other one is probably coming from the @OutputFiles in AbstractArchiveTask.

Maybe it is a misusage of the API from the OneJar plugin but I though about asking before maybe creating an issue on the OneJar side and also to understand why it worked with Gradle 2.3.

Thanks,

Youri

Thanks for the sample project. I see the same output with 2.3 and 2.4. I took out the exception and added the gradle version:

macbook:gradle-one-jar-2.4 sterling (master *=) $ ./gradlew print printDebug
called standalone.jar
Gradle version = 2.3
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar UP-TO-DATE
:oneJar UP-TO-DATE
:print
[standalone.jar, gradle-one-jar-2.4-standalone.jar]
:printDebug
[standalone.jar, gradle-one-jar-2.4-standalone.jar]

BUILD SUCCESSFUL

Total time: 1.453 secs
macbook:gradle-one-jar-2.4 sterling (master *=) $ vim gradle/wrapper/gradle-wrapper.properties -> s/2.3/2.4//
macbook:gradle-one-jar-2.4 sterling (master *=) $ ./gradlew print printDebug
called standalone.jar
Gradle version = 2.4
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:oneJar
:print
[standalone.jar, gradle-one-jar-2.4-standalone.jar]
:printDebug
[standalone.jar, gradle-one-jar-2.4-standalone.jar]

BUILD SUCCESSFUL

Total time: 1.471 secs

Should I see something different?

@sterling you are perfectly right, I did not analyzed correctly the problem and thought it was related only to Gradle 2.4 (as I encountered other issues with one jar and Gradle 2.4).

The issue seems to come from OneJar 1.0.4, with 1.0.3 it seems ok.
The change is https://github.com/rholder/gradle-one-jar/commit/bcab0e117ccb04c1b022f4627eb1d12b62cc19b3
However I don’t quite get why getArchiveName() would only return standalone.jar but here maybe the task is not supposed to define a new output file anyway.