# Version groups

> A version group pins one exact version of every package, and every project that uses it builds with exactly those.

**A version group pins one exact version of every package, and every project that uses the group builds with exactly those.**

It's like: a branch in git, where each change is a new revision
You name it: in your workspace, as `main@202`
It lives in: your organization, which starts with `main`

## Why it exists {#why}

Without one, every repository picks its own versions. Two services end up on two versions of the same library, and the JDK is whatever the build machine has. With a group, each version is decided once, in one place, for every project, and the toolchains are pinned like the libraries.

## See it change {#see-it}

Your team's group is `main`. Your workspace builds two projects, MyLib and MyService. Click through what happens as people work.

## Revisions {#revisions}

Every change to a group makes a new revision: a build that releases, an import, a pointer that moves, a merge. A revision never changes once it is made, so `main@202` means the same pins today and in a year.

Your workspace names one revision, and stays on it until you move it. When the group has moved on, every build says so:

```sh
$ plinto build
Version group main has moved on to revision 203: `plinto update` moves the workspace to it
```

`plinto update` moves it to the newest revision, and lists what changes; `plinto update <revision>` moves it to any other one, older ones too:

```sh
$ plinto update
Moved plinto-workspace.conf from revision 201 of main to 202
  MyLib 1.0-3 → 1.0-4 (declared here)
  MyService 1.0-7 → 1.0-8 (declared here)
```

The command line shows each release's full number; the apps show it as `1.0 (e4f5a6b)`, its line and the commit it was built from. Revisions are numbered across your organization's groups, so one group's numbers can skip.

## Pointers: `Java = 25` {#pointers}

A project doesn't name the exact JDK. It says `Java = 25`, and the group points `25` at one exact release. When the next patch comes out, the group moves the pointer once and every project gets it, without anyone editing a `plinto.conf`.

| Your plinto.conf says | main@202 pins | main@203 pins |
|---|---|---|
| `Java = 25` | `25.0.4.10.1` | `25.0.5.11.1` |
| `Guava = 33.7.2-jre` | `33.7.2-jre` | `33.7.2-jre` |
| `MyLib = 1.0` | `1.0 (e4f5a6b)` | `1.0 (e4f5a6b)` |

**A version must match a pin.**
A `plinto.conf` names either an exact version the group has, or a line it points somewhere. Anything else fails, and the error says what the group has:

```text
HelloApp needs Guava 34, but version group main pins Guava 33.7.2-jre
```

Getting a new version into the group is an import. See [Version rules](../reference/version-rules.md).

## A group of your own {#branches}

A group made from `main` is a place to try something without stopping anyone: a new JDK, a big upgrade, a team that wants to move at its own speed. It starts with main's pins, and keeps up by merging main's changes in.

- **Make one** with **New group** in the Groups app, or **Branch from here…** on any group.
- **Merge** from the Builds app: it brings in the new releases of what your group already holds (MyLib 1.0-3 → 1.0-5) and the pointers it points. An imported library's new version is a version of its own (Guava 33.4.1 beside 33.4.0): it comes with a pointer that moves to it, with something the merge takes that needs it, or when you tick **Bring new packages and versions**, as new packages do.
- **Hold** a package to keep its version while everything else moves on. A version a person sets by hand is held, so no merge replaces it.
- **Compare** any two revisions in the Groups app, to see every pin that changed between them.

## What it is not {#not}

**Not a lockfile.**
One group serves every project of your team, so there is no lockfile per repository to keep up to date, and no two services quietly on two versions.

**Not "latest".**
Nothing in plinto means "the newest". A build gets what its revision pins, so the same commit builds the same way next month.

## Common questions {#faq}

**Why is my build using an old version?**
Your workspace names a revision, and stays on it. `plinto update` moves it to the group's newest one, and every build says when the group has moved on.

**Can two projects use two versions of one library?**
Of a Maven artifact, an npm package or a toolchain, yes: a group can hold several, and each project names the one it uses. Of a Go module, a crate, a PyPI project or a Hex package, a group holds one version.

**How do I get a newer version of a library?**
It has to be in the group first. If someone already imported it, `plinto update` brings it; otherwise [import it](packages.md#imports), which makes a new revision.

- [Reviews](reviews.md): a change, built with all it touches, before anyone merges
- [Packages](packages.md): what a group pins
- [Version rules](../reference/version-rules.md): what a version in plinto.conf matches
