I like to be thorough in the information I put into the pom generated by Gradle and published with my artifacts. In fact, many repos insist on thorough pom information for uploading to them. However, pom customization in a typical multi-module build shares a lot of information with just a little bit (id, name, description mainly) being specific to each module. To implement this atm I use the subprojects closure from the root project and set up the publishing for every module. For the specific bits I rely on the subprojects defining methods like pomName()
, pomDescription()
, etc and using them from within the subprojects closure as I define publishing. It works, but it feels quite un-Gradle-like to me. So I have been contemplating ways to make this more Gradle-like (more declarative). I am thinking something along the lines of a Plugin that adds an extension for these “specific bits” and then accesses the publication to alter its pom based on that information.
Is it possible to access the pom for a publication outside the publishing.publications
block? If so, how? Is it “just” a NamedDomainObjectContainer?