Maven-publish pom incorrect unless publications is in afterEvaluate

Gradle version 2.2, maven-publish

If the publishing.publications section is not in an afterEvaluate block, the pom does not seem to be generating any dependencies.

Seems to be the same problem people are talking about recently here:

(Old question that was revived for 2.1.1 and 2.2)

1 Like

I have tried it using and it till did not work for me. any clues. gradle version 2.2.1

Would you mind posting your build.gradle block? I can’t seem to get it to work.

As I’ve yet to be able to find any solution, do you have a code sample we could use in the meantime?

I tried setting up a very simple project (three java projects, one that depends on the other two) and maven publish just works without having to wrap it in an afterEvaluate block.

Since I don’t have a minimal failing project, I can’t really say it is a surefire fix, i just know on my (large and complicated) project, dependencies were not showing up and putting the publishing.publications into an afterEvaluate block seemed to resolve it.