# plinto.conf

> Every key of a project's plinto.conf, its syntax, and what each block holds.

A project's file, next to its `src/`. See [Projects](../concepts/projects.md) for what it is for.

## Syntax {#syntax}

JSON without the ceremony:

- No quotes needed, and the outer braces are optional.
- `key = value` sets a value, `key: { … }` opens a block, and `[a, b]` is a list.
- Entries are separated by new lines or commas.
- `#` and `//` start a comment at the start of a line or after a space, so `https://…` is safe.
- Quote a value that holds `,`, `}`, `]` or a comment mark.

A mistake names its line and column:

```text
plinto.conf:4:3: error: duplicate key 'build' (first defined at 3:3)
```

## Keys {#keys}

| Key | What it says |
|---|---|
| `name` | the project's name, which is its package's: `HelloApp` (required). Letters, digits, `.`, `_` and `-`, starting with a letter or digit |
| `version` | its version line: `1.0` (required). Letters, digits, `.`, `_`, `+` and `-`, starting with a letter or digit |
| `build` | its build system: `JavaBuild` (required) |
| `build-dependencies` | the build system, its toolchain and what else the build runs |
| `dependencies` | what the code uses |
| `test-dependencies` | what only the tests use |
| `main` | what a program runs, which makes the project a program: see [below](#program) |
| `args` | what a program starts with: `[--port, 8080]` |
| `packager` | how a program is packed to run on a server; leave it out for `Archive`, the default, or `Docker` for an image ([how](../guides/docker-images.md)) |
| `dependency-resolution` | which version wins where the project reaches two: see [below](#dependency-resolution) |
| `group` | a group for the jar's manifest, for JVM projects |

A build system may add its own, such as `java: { … }` for [Java](../languages/java.md#settings) and `typescript:` for [TypeScript](../languages/node.md#settings).

## A program: main and args {#program}

A project that names its `main` is a program: `plinto run` starts it, and a release packs it to run on a server. Without one it is a library, which other projects use. `main` says what runs in the language's own words, and `args` what it starts with, before the arguments `plinto run` is given:

| Build system | `main` is | For example |
|---|---|---|
| JavaBuild, KotlinBuild | the main class | `main = shop.Main`, `main = shop.MainKt` |
| NodeBuild | a file in `src/` | `main = src/server.ts` |
| PythonBuild | the module `python -m` runs | `main = Shop.server`, or `main = Shop` for its `__main__.py` |
| GoBuild | the folder of the `package main` | `main = src`, `main = src/cmd/server` |
| RustBuild | the binary's root, in `src/` | `main = src/main.rs` |
| ElixirBuild | the application's module | `main = Shop.Application` |

```conf file=plinto.conf
name = Shop
version = 1.0
build = GoBuild
main = src/cmd/server
args = [--port, 8080]
build-dependencies: { GoBuild = 1.0, Go = 1.27 }
```

Projects written before `main` and `args` named them otherwise, such as `main-class`, `main-package` or `run: { args = [...] }`, or had a file where the language puts one, such as `src/main.rs`. They still build the same, and the build warns with the line to write instead.

## Dependencies {#dependencies}

```conf
dependencies: {
  MyLib = 1.0                                       # a line: its newest release in the group
  Guava = 33.7.2-jre                                # an exact version
  Serde: { version = 1.0.229, features = [derive] } # with more for the build system
}
```

A version must be one the group has, exactly or as a line it points somewhere: see [Version rules](version-rules.md).

## dependency-resolution {#dependency-resolution}

When the libraries a project uses need two versions of one package, the build stops and shows the tree:

```text
app uses LibOne 2.0 and 1.0, but a project can use only one version of a package:
  app
  ├── LibOne 2.0
  └── LibTwo 1.0
      └── LibOne 1.0
Pick one in app's plinto.conf (any version the group has):
  dependency-resolution: {
    LibOne = 2.0   # or 1.0
  }
```

The pick holds for that project's whole tree, and only for it. An entry that resolves no conflict is an error, so the block never outlives its reason.

- [The workspace file](workspace-file.md): plinto-workspace.conf
- [Configuration files](configuration.md): configuration/&lt;Package&gt;.config
- [Version rules](version-rules.md): what a version matches
