Audience: contributors and maintainers. How Book’s version is derived, how it flows into the CLI, and how a release is made.

Book uses shipkit-auto-version. Git tags are the single source of truth for the project version. There is no version number to update by hand, no bump commit, and no version file to maintain.


How the version is derived

The shipkit-auto-version Gradle plugin is applied once at the root project (build.gradle.kts), and every subproject (including :jvm:cli) inherits project.version from it.

Its configuration lives in version.properties at the repository root:

version=0.9.*

tagPrefix=
Property Meaning

version

The version spec (supports wildcards). The plugin resolves the version from the highest git tag matching this spec.

tagPrefix

Optional tag prefix. Empty in Book. Tags are bare semver (0.9.0), not v0.9.0. A v-prefixed tag will not be picked up.

Resolution rules:

  1. A tag matching the spec exists on the current commit (e.g. 0.9.3): the version is exactly that tag.

  2. No matching tag, or the commit comes after the tag: the plugin computes the next release version from the spec (0.9.* gives a 0.9.0 base, since bump=0) and appends build metadata identifying the commit.

  3. No tags at all: the plugin falls back to the spec’s base version (0.9.0).

Check the resolved version any time:

./gradlew :jvm:cli:properties -q | grep "^version"

version.properties is a spec, not the version itself. Changing 0.9. to 0.10. moves development to the next minor series. Never edit it to bump a release; tag instead.


How the CLI gets its version

BookArgCommand logs the version at startup, and the build generates that value. There is no hard-coded version constant in the source.

  • The generateAppVersion task in jvm/cli/build.gradle.kts writes us/nineworlds/book/cli/di/AppVersion.kt into jvm/cli/build/generated/version/, containing the resolved project.version.

  • The generated directory is registered as a source set directory, and KotlinCompile tasks depend on generateAppVersion, so the file is regenerated before compilation.

  • AppVersion.VERSION is a const val, so the compiler inlines the value into the bytecode, including the shadow jar.

The jar name and the CLI’s startup banner always carry the version shipkit derived from the tags. Tag 0.9.5 produces cli-0.9.5.jar printing Book starting (version=0.9.5, …​). Do not edit files under build/generated/; the build regenerates them.


Making a release

The whole release flow:

git tag 0.9.3          # bare semver, matching the spec in version.properties
git push origin 0.9.3

A tag push to GitLab runs the release pipeline. The tag is the version, and no version file needs to be updated beforehand.

Release conventions:

  • Tags are bare semver (0.9.3), matching the version spec in version.properties. Do not use a v prefix unless you also set tagPrefix=v in version.properties.

  • Tag the commit you want to release on the default branch after it is green. Never re-point or move an existing tag.

  • To move to the next minor series, flip the spec in version.properties (e.g. 0.9. โ†’ 0.10.) in the commit after the release, so subsequent development resolves to the next version.


Where the version appears elsewhere

Location How it gets the version

Gradle builds / published artifacts

project.version via shipkit-auto-version (root)

:jvm:cli banner & jar name

Build-generated AppVersion.VERSION (above)

install.sh banner

git describe --tags --abbrev=0 --match "<spec>", mirroring shipkit’s tag selection; falls back to the spec’s base version when no matching tag exists

CI release job (.gitlab-ci.yml)

The pushed tag itself. The pipeline reads the version from the tag, not from any file


Further reading

  • Publishing configuration (GitLab Maven registry, Sonatype/Central): Maven Publishing.

  • The ADR that decided this mechanism: prompts/plans/adr/ADR-20261111-shipkit-auto-version-maven-publishing.md.