# Elide Projects

> Configure, build, run and inspect an Elide project.

A project is a directory with an `elide.pkl`. Outputs, dependencies, reports and build state go in `.dev/`. Run
commands from the project directory, or pass `-p PATH`.

```bash
elide init --templates   # java, ktjvm, web-simple, web-demo, workspace
```

## Minimal JVM project

```pkl
amends "elide:project.pkl"

name = "hello"

jvm {
  main = "sample.HelloKt"
}
```

`src/main/kotlin/sample/Hello.kt`:

```kotlin
package sample

fun main() {
  println("Hello from Kotlin")
}
```

```bash
elide install
elide build
elide run
```

`src/main/kotlin` is found without a `sources` block; see [Source Sets](https://elide.help/docs/toolchain/source-sets).

<img src="https://elide.help/assets/demos/project-build.gif" alt="Building and running a Kotlin project with Elide" width="1591" height="910" loading="lazy" decoding="async" class="rounded-lg border border-border my-6 w-full" />

`elide build --inspect` lists the tasks and their options; see [Build Tasks](https://elide.help/docs/toolchain/build-tasks).

## Named scripts

```pkl
scripts {
  ["greet"] = "echo hello"
}
```

```bash
elide run greet
```

Scripts run under `/bin/sh`. An existing file takes precedence over a script name. Otherwise Elide looks in manifest
scripts, then `package.json` or `pyproject.toml` scripts, then `node_modules/.bin`.

## Dependencies

Declare Maven, npm and PyPI packages under `dependencies`; `elide install` resolves them. See
[Dependencies](https://elide.help/docs/toolchain/dependencies) and the [reference](https://elide.help/docs/elide-pkl-reference#dependencies).

## Workspaces

A workspace root lists member projects and builds them as one task graph. `elide init --template workspace` creates
one. See [Workspaces](https://elide.help/docs/elide-pkl-reference#workspaces).

## Inspect the resolved project

```bash
elide project info                 # resolved source sets, dependencies, artifacts
elide project advice               # usage advice for coding agents
elide project export               # the resolved manifest as JSON
elide project export --format=pom  # or intellij
elide classpath                    # the main compile classpath, one entry per line
elide classpath test:runtime       # [<source-set>:]<usage>
```

`-f` flags change the export. Formats: [Project export formats](https://elide.help/docs/cli-references#project-export-formats).
Classpath usages: [Source Sets](https://elide.help/docs/toolchain/source-sets#dependencies-and-classpaths).

## Pin the Elide version

`elide use <version>` writes `.elideversion` and installs that version for the directory; `--no-install` only writes
the file. `toolchain.engines` in the manifest states accepted versions; see
[Toolchain](https://elide.help/docs/elide-pkl-reference#toolchain).
