Gradle 1.12-rc-2: MavenPublish "groupId cannot be empty"

Just testing out the latest RC and ran into a problem with an existing build. It seems that a change in the MavenPublish code requires that

is set BEFORE the

publishing {}

block is configured. Otherwise you receive the error:

* What went wrong:
Execution failed for task ':publishPluginPublicationToMavenLocal'.
> Failed to publish publication 'plugin' to repository 'MavenLocal'
   > Invalid publication 'plugin': groupId cannot be empty.

Workaround is to move the

group = ''

to before the publications are declared.

Actually, it looks like none of the configuration for the publication works if the publication is declared first. Dependencies do not show up in the POM if they are declared after declaring the publication either.

Can you please check if this is a regression from 1.11?

Sure. I’m actually having trouble reproducing this in a new project. So it might just be something with my project. I’ll post an update soon.

Ok, so I think I tracked this down and just being an issue with my setup doing this:

bintrayUpload { task ->

looks like this didn’t work for PublishToMavenLocal for while (as far back as Gradle 1.9), I think I just never did it before, so never encountered the problem till today.

Declaring the ‘dependsOn’ that way forces a resolve on the publication and the groupId would need to be declared at that point, so this seems like correct behavior. I’m satisfied with that answer.