# Workspaces

> A workspace is a folder of projects, all built against one revision of one version group.

**A workspace is a folder of projects, all built against one revision of one version group.**

Its file: `plinto-workspace.conf`
Its projects: folders in its `src/`
Start one: `plinto workspace create shop --version-group main`

## The file {#file}

```conf file=plinto-workspace.conf
{
  version-group = main@202    # the group, and the revision every build uses
  projects = [MyLib, MyService, apps/MyWeb]
}
```

Each project is a folder in `src/`: `apps/MyWeb` is `src/apps/MyWeb`. A workspace has one such file; another one inside a project is ignored, with a warning.

Every command works in the workspace you are in, wherever in it you run it. `-p src/MyService` names a project, and `-a` means all of them.

## It stays on its revision {#revision}

The workspace builds with exactly what `main@202` pins until you move it, so nothing changes under you in the middle of a task. When the group moves on, builds say so, and `plinto update` moves the workspace. See [Revisions](version-groups.md#revisions).

## Projects that need each other {#projects-that-need-each-other}

When MyService depends on MyLib and both are in the workspace, MyService builds against MyLib's **release in the workspace**, never against its code directly. So release MyLib first:

```sh
$ plinto release -p src/MyLib
$ plinto build -p src/MyService
```

`plinto release -a` releases every project, those others need first. Until you release MyLib again, MyService keeps the release it has, whatever you changed in `src/MyLib`. `plinto build --release-dependencies` does both in one go: it releases what the project needs, then builds it, as IntelliJ IDEA and VS Code do.

A release in the workspace stays on your machine, in `.dependencies/`. Only the build service makes releases others get: see [Builds](builds.md).

**If it hasn't been released yet,**
the build says so:

```text
shop needs the workspace project Money, which has no release in the workspace: `plinto release` it first (or `plinto release -a` for the whole workspace)
```

## What's in it {#layout}

| Folder | What it holds |
|---|---|
| `src/<Project>/` | each project, with its own `build/` |
| `.dependencies/` | the releases `plinto release` made, and the group's pins, kept for working offline |
| `.run/<Project>/` | where `plinto run` runs a program, with the programs it depends on in `bin/` |

`plinto workspace clean` deletes the releases; `plinto clean -a` deletes every project's `build/`.

## Someone else's package {#add}

```sh
$ plinto workspace add MyLib
```

clones MyLib's source into `src/MyLib` and adds it to the projects, so the projects that depend on it build against your copy. `plinto workspace remove MyLib` takes it out again, and refuses when that would lose work that is nowhere else.

- [Quickstart](../start/quickstart.md): a workspace and a project, built and running
- [The workspace file](../reference/workspace-file.md): every key
- [Version groups](version-groups.md): what a workspace builds against
