Hello Pat,
Unfortunately there is no way to specify the revision within the build that I'm aware of but, I think that's generally a good thing**. Below is an outline of how I would approach doing a Continuous Delivery (CD) pipeline using maven. It assumes you subscribe to "build once, reuse everywhere" and are open to ignoring mavens "best practises" regarding revisions tracked in SCM.
1. Keep the pom.xml as 0.0.0.0-SNAPSHOT in source control (quick way to identify dev from release candidates).
2. Prefer clean checkouts/workspaces (assuming it doesn't impose too much of an impact on build time).
3. For the Go label use a manual identity for major and minor, Go's count for revision, SCM revision for a sub-revision (unfortunately I don't think Go supports git short revs yet).
4. First step in the build run;
mvn --batch-mode release:update-versions -DautoVersionSubmodules=true -DdevelopmentVersion=${GO_REVISION}-SNAPSHOT
5. Run the maven package target.
6. Consume package as an artefact.
There's likely a better way to generate an artefact that *isn't* a snapshot but, the above should be acceptable for a service in my opinion. Keep in mind that if everything is a release candidate the idea of "tagging" a release becomes outmoded. For libraries you'd likely want to do an actual release as the first step which is slightly more tedious due to SCM integration. The primary benefit for the above is reduced SCM churn/noise in your pom files related to version bumping, less effort related to releases (its done automatically as part of the commit) and greater visibility of the release process/progress via Go.
The following are some of the tenants of CD which Go either depends on for the greatest benefit or aides with.
a) your trunk is (almost) always in a "releasable" state,
b) everything reasonable is automated (inc./esp. this component of the release process) and
c) the process is ideally repeatable and reliable (aka idempotent).
The following problems come to mind with the "out-of-band increment" your suggesting whereby the version is extracted from a POM file or by other means beyond Go's management;
1) it requires that someone ensure the revision is updated with some regularity (sometimes tedious/error-prone w/ multi-module maven projects and is also a *minor* communication overhead) and
2) it imposes a need to ensure a unique identity is generated for every release candidate.
To support the above statements consider;
i) What happens if the revision in the pom.xml or the script that generates the artefacts UID fails (hash collision or some other unexpected edge case)?
ii) Where does the code for UID exist and who maintains ownership of it? Is it a project of its own, packaged with each project, exist as a sub-module, etc?
iii) How does a label collision impact an operators understanding (e.g. QA or Operations) of available deployments for environments they own and deploy to? If r1.3.4 is created twice there is an exceptional case where a developer needs to convey not just the build label but, also the date/time it was generated. Each additional variable increases complexity and potential for error during hand-offs.
iv) What happens when the same source is resubmitted for a build with a different tool-chain, flags, etc? The label ceases to be a unique identifier for a single binary but, could represent multiple. Ideally any changes to the compilation and resulting binary would be captured in it's label.
v) what happens if you're releasing n times a day where n could be as often as every 15-20mins? How would you co-ordinate and communicate release versions?
In conclusion by allowing Go to manage the "identity" of an artefact it encourages a uniqueness that is unlikely to have a collision through neither human error or malicious intent. Furthermore, communication and traceability becomes simplified as the build identity is basically synonymous with a single binary rather than a manually carved "release" where multiple *attempts* maybe required.
** I admit there are some organisational processes where it would be desirable to consume artefacts and/or revisions outside of Go's management. However, in my experience the organisations with such processes in place are often a long way off from automated CD.
Kind Regards,
Nathan