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


(Abhijit Sarkar) #1
publishing {
    publications {
        myPublication(MavenPublication) {
            groupId 'name.abhijitsarkar.learning.lucene'
         artifactId 'lucene-common'
         version '1.0'
                      from components.java
        }
    }
    repositories {
        mavenLocal()
    }
}
* 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.

(Peter Niederwieser) #2

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


(Abhijit Sarkar) #3

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 project.name 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 http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html 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".

(Peter Niederwieser) #4

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


(Abhijit Sarkar) #5

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