3

Starting from version 5 gradle changed Archive Tasks behavior

This breaks shadowJar task default behavior which doesn't create <name>-<version>-all.jar artifact any more.

How to revert this behavior and create *-all.jar?

radistao
  • 14,889
  • 11
  • 66
  • 92

1 Answers1

6

Instead of using deprecated classifier and archiveName configure shadowJar plugin the following way:

shadowJar {
    archiveClassifier = 'all'
}

Or since Gradle 5.1 using Property:

shadowJar {
    archiveClassifier.set('all')
}

See more about the issue discussion:

https://github.com/johnrengelman/shadow/issues/446#issuecomment-460328699 https://github.com/johnrengelman/shadow/issues/450

radistao
  • 14,889
  • 11
  • 66
  • 92
  • Intellij suggests that I can't set archiveClassifier to a string (being a property), and instead use archiveClassifier.set('') – Brian Agnew Feb 12 '20 at 12:32
  • This is a new Gradle API with `Property` value (https://docs.gradle.org/current/javadoc/org/gradle/api/provider/Property.html) instead of old `String` – radistao Feb 12 '20 at 16:23
  • New Gradle DSL API since version 5.1: https://docs.gradle.org/5.1/release-notes.html#conveniences-for-map-properties – radistao Feb 12 '20 at 16:33