jar plugin incorrectly duplicates all files if sourcesSets.main.output.{classes,resources}Dir are the same

Hello,

I recently noticed that while working on a pull request for the gradle-fatjar-plugin, which appended twice to ‘META-INF/services/*’ files. Happens every time!

What is more, I also found a bug in the osgi plugin: if you happen to modify ‘sourceSets.main.output.classesDir’, you MUST add this in order for the manifest to be generated at all:

‘’'jar {

manifest {

classesDir = theActualValueNotTheDefaultPlease

} } ‘’’

otherwise the plugin fails because it cannot find ‘build/classes/main’.