ci: tim-brown Update POMs for building of BOMs and migration to maven central publishing portal#14
Conversation
…entral publish portal
|
Thanks Tim! I don't expect I'll get to looking at this soon, but I have raised it internally to see if anyone wants to use this opportunity to learn about this stack. |
There is a reason why the BoM stands apart. It needs to not include the project dependencies, as this would force downstream project to use these dependencies with the specified version in some circumstances. This is due to how maven handles dependency versions when compiling (shallowest then first in a breadth first search of the dependency tree). The solution I have found to do this is to make sure the BoM is on its own, and does not reference a parent.
I was not aware of these requirements, but this makes sense.
The BoM will definitely need some duplication similar to the parent pom because of that separation need. |
Releases of Ocava have not been deployed to maven central for some time now. I have tried to fix this (frankly, so I can show off
Lookup)... and discovered/fixed a few fun things.From a branch on my fork, I have managed to draft a release, running the release action. It builds, tests, and invokes the
central-publishing-maven-plugin. Pipeline fails with:I think this is as far as I can go... my sonatype account won't allow me to publish
com.ocadotechnologyartifacts; and the signature is not going to be signing the wrong thing. So attached to this PR is the full error report; evidencing that I've got as far as I could before failure.I acknowledge there is a fairly large number of critical design decisions I have made here; but I think you'll need to deal with the OSSRH → central migration sooner or later (and the deadline is rocking up pretty quick). OTOH, I'll take no offense if you just use this PR as inspiration. Good luck with it.
Note this is a
cisemantic change, so it won't trigger a release; anyway, I guess that after reading the PR, you'll want to hand-hold this through.maven-release.yml,maven.yml:@2seems to have shut this upversions:set, meaning that later in the build,bom:(new-version)isn't found: this is handled withversions:set -DprocessAllModulesSonatype is migrating away from publishing via OSSRH to a new central publishing mechanism. I touch on it in one of my comments: https://central.sonatype.org/publish/publish-portal-maven, but this is by far not the extent of the reading. There are new secrets to be managed, and I think these will be global to
com.ocadotechnology, I don't know how the internal open source community works there, but aligning on this might be worthwhile. So.mvn/settings.xmland maybepom.xmlandBoM/pom.xmlwill need better secrets (PGP, maybe, but probably not) management than I have here.All
**/pom.xml:<licences>,<developers>,<scm>and<name>; the first three are inherited from parentpom.xml, but<name>had to be added to all POMs..mvn/settings.xml:central. I have added an entry here forcentral, but I'm still usingossrh_loginossrh_passwordsecret environment variables. You will need to manage this better. Leaving the two entries hopefully allows for a smoother migration, but you should be aiming at removing theossrh` entry.Parent
pom.xml:bintray, but pointed it at central... you need a repository. I really think this needs thinking through a bit more thoroughly. But it seems to work.nexus-staging-maven-plugintocentral-publishing-maven-plugin: distribution repositories are implicitlycentral, and need new credentialsdeploy.plugin.version: some part of this process didn't seem to work with thisdistributionManagement:central-publishing-maven-plugindefines its own distribution targets (you can override them, but why?). It seems a bit odd to me that you are building an OSS artifact, then distributing it exclusively to your internal nexus. My suggestion is start with this configuration (distribute to central); let your nexus mirror pick up from central, and only if that is too slow/broken try to distribute directly to your nexus... I might be missing something.BoM/pom.xml:pom.xml-- why? I can't fathom... but AFAICT, it needs these two plugins mentioned for thereleaseprofile. The plugin definitions are identical topom.xmldistributionManagement: for the same reason as parentpom.xmlBoM/pom.xmldid not inherit the required metadata, so<licences>,<developers>,<scm>and<name>have been copied in from parentpom.xml