Error on maven-publish (example taken from docu)

Hi anyone,

I want to publish maven artefacts and so I thought it’s a good idea to use maven-publish plugin.
First question: This is incubating for a long while - is it nevertheless the plugin to use best?
Second question: I want to add source jars to normal upload, so I wanted to use the code snippet of the gradle documentation:
task('sourceJar',type: Jar) { from sourceSets.main.allJava classifier "sources" } publishing { publications { mavenJava(MavenPublication) { from components.java artifact sourceJar } }

But I get an error:

Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method call() for arguments [vsa.gradle.vsareleasemaven.ReleaseMavenPlugin$_apply_closure2$_closure4$_closure6$_closure7@134c38] on task ‘:vsa.gradle.vsareleasemaven.ReleaseMavenPlugin$_apply_closure1@738a815c’ of type org.gradle.api.tasks.bundling.Jar.

Can you please tell me what I do wrong and how to fix it?

Thanks in advance
Cheers
Markus

you made a tiny mistake. Your task has a name and should really be:
task sourceJar(type: Jar) {

1 Like

Hi Carlo,

thanks for your reply, I have adapted my example and it works.