Skip to content

Project setup

Set up an Elide project with elide.pkl: elide init templates, named scripts, dependencies, workspaces, and pinning the Elide version.

On this page

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.

See The .dev directory for generated files, workspace paths and cleanup.

Terminal
bash
elide init --templates   # android, java, ktjvm, spring, micronaut, web-simple, web-demo, workspace

Create a project without prompts

elide init opens an editor in a terminal. In scripts and CI, pass --plain --skip-defaults, a template and its parameters as name=value:

Terminal
bash
elide init --template java --parameters          # list parameters and blocks
elide init --template java --parameters --json   # the same, as JSON
elide init --plain --skip-defaults --skip-run --template java \
  project_name=greeter package=dev.acme greeting="Hi there" tests=false
text
elide.pkl
src/main/dev/acme/Hello.java
utf-8 · text · Lines: 2
ArgumentEffect
NAME=VALUE or NAME VALUESets a parameter; omitted parameters take their defaults.
BLOCK=true, BLOCK=falseTurns an optional block on or off: tests (test sources), mcp (.mcp.json).
--skip-runDoes not run Elide after generating files.
--overwriteReplaces existing files.
InputResult
No terminal, without --plain --skip-defaultsExit 2: `elide init` needs an interactive terminal.
A value that fails validationExit 2: Parameter "package" value "1bad" validation failed with error: "Not a valid Java package name."
A block value other than true/falseExit 2: Could not parse block "tests" value "maybe" as boolean, it must be true or false
An unknown nameWarning No parameter or block "colour" exists, value "red" will be ignored; exit 0

Create a JVM project

pkl
amends "elide:project.pkl"

name = "hello"

jvm {
  main = "sample.HelloKt"
}
utf-8 · pkl · Lines: 7

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

kotlin
package sample

fun main() {
  println("Hello from Kotlin")
}
utf-8 · kotlin · Lines: 5
Terminal
bash
elide install
elide build
elide run

src/main/kotlin needs no sources block; see Source Sets.

Building and running a Kotlin project with Elide
 ~/demo  elide build
[10.5s] ✓ Resolved 7 Maven dependencies (10.4s)
[10.6s] ✓ Compiled 1 main Kotlin source file (128ms)
[10.6s] ⇥ Java main compilation skipped (No sources)
[10.6s] ✓ Build successful in 10.6s
 ~/demo  elide run
[ 11ms] ⇥ Dependencies ready (Up to date)
[ 12ms] ⇥ Kotlin main compilation skipped (Up to date)
[ 12ms] ⇥ Java main compilation skipped (Up to date)
Hello from Kotlin!
[ 69ms] ✓ JVM main application completed successfully (57ms)
[ 74ms] ✓ Build successful in 64ms
 ~/demo  elide build
[ 12ms] ⇥ Dependencies ready (Up to date)
[ 12ms] ⇥ Kotlin main compilation skipped (Up to date)
[ 12ms] ⇥ Java main compilation skipped (Up to date)
[ 29ms] ✓ Build successful in 19ms
 

elide build --inspect lists the tasks and their options; see Build Tasks.

Add a script

pkl
scripts {
  ["greet"] = "echo hello"
}
utf-8 · pkl · Lines: 3
Terminal
bash
elide run greet

Scripts run under /bin/sh. elide run NAME picks the first match: a file, then elide.pkl scripts, then package.json or pyproject.toml scripts, then node_modules/.bin.

Add dependencies

Declare Maven, npm and PyPI packages under dependencies; elide install resolves Maven and npm packages, not PyPI (Python packages). See Dependencies and the reference.

Create a workspace

A workspace root lists member projects and builds them as one task graph. elide init --template workspace creates one. See Workspaces.

Inspect a project

Terminal
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, `:`-separated
elide classpath test:runtime       # [<source-set>:]<usage>

-f flags change the export. Formats: Project export formats. Classpath usages: Source Sets.

Pin the Elide version

Terminal
bash
elide use 1.6.0               # write .elideversion and install that version
elide use 1.6.0 --no-install  # only write the file

toolchain.engines in elide.pkl lists accepted versions; see Toolchain.

Was this page helpful?