The default classifier for a sources jar in maven is ‘sources’, and all tools I know use the same string to download source jars, and will probably fail if the source is uploaded with any other classifier.
Yet the main example on MavenPublication within the Gradle 2.2 documentation, which shows how to attach a source jar, is using a different classifier. Everyone who copy’n pasted this snippet is now uploading their source incorrectly.
There are more examples within the methods description which use yet another classifier, and incorrectly show how to configure an artifact, because this code snippet
artifact sourceJar {
// These values will be used instead of the values from the task. The task values will not be updated.
classifier "src"
extension "zip"
}
is configuring the task, not the artifact, as the closure is called on ‘sourceJar’ not passed in as argument to the method due to missing parenthesis. It works, but the example is wrong, and it does update the task values.