I was trying out the 2.2-nightly for the sonar runner updates, but my build failed because it could no longer find the ‘generatePomFileFor*Publication’ tasks.
* What went wrong:
A problem occurred configuring project ':subProject'.
> Could not find property 'generatePomFileForMavenJavaPublication' on project ':subProject'.
Nothing in my build files changed, so I am not sure why this is happening.
Thanks for checking out the nigthly build and reporting this to us. This is a breaking change introduced recently. We will add information to the release notes about it soon.
From now on you will have to put this logic in ‘model {}’ block like this:
model {
tasks.generatePomFileForMavenJavaPublication {
dependsOn 'someOtherTask'
}
}
Please let me know if you’re interested in detailed explanation why that is and I will provide it.
Yes, it is possible to contribute to model configuration from a plugin class.
Please be aware that this stuff is incubating and under active development so you should expect breaking changes. It is also undocumented as of now(this should change for 2.2) so you will have to dig into some code and tests to understand how to use it.
Basically the trick is to add a static, @RuleSource annotated class to a plugin which can have methods annotated with @Model, @Mutate and @Finalize. As an example have a look at MavenPublishPlugin.Rules class. Also, you might get better understanding of usage and limitations from integration tests for modelCore project.