Maven-publish plugin: DefaultMavenPublication can't find method groupId

publishing {
    publications {
        myPublication(MavenPublication) {
            groupId 'name.abhijitsarkar.learning.lucene'
         artifactId 'lucene-common'
         version '1.0'
    repositories {
* What went wrong:
A problem occurred configuring root project 'common'.
> org.gradle.api.internal.MissingMethodException: Could not find method groupId() for arguments [name.abhijitsarkar.learning.lucene] on org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication_Decorated@5cb08ba7.

Which Gradle version? Does adding a ‘=’ after ‘groupId’ help?

Gradle 1.6. Adding = gets rid of the exception. However, it introduces a bunch of warning and Gradle seems to ignores those values anyway. It also ignores the archivesBaseName = ‘lucene-common’ defined and uses the as the artifact name.

Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read for information on the replacement for dynamic properties.
Deprecated dynamic property: "groupId" on "org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication_Decorated@59cfb84c", value: "name.abhijitsarkar.lea...".
Deprecated dynamic property: "artifactId" on "org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication_Decorated@59cfb84c", value: "lucene-common".
Deprecated dynamic property: "version" on "org.gradle.api.publish.maven.internal.publication.DefaultMavenPublication_Decorated@59cfb84c", value: "1.0".
1 Like

Setting Maven coordinates on a publication was only introduced in 1.7. Not sure if ‘archivesBaseName’ is used by ‘maven-publish’.

Don’t you think it should honor the values set by the archive it is trying to publish, as we’re using ‘from’?