Elide Projects
Elide is capable of creating and managing Elide-native projects through a project toolchain.
An Elide Project consists of:
- Project manifest -
elide.pklis a powerful configurable Pkl-based manifest. - Work directory -
.devacts as an internal directory, that Elide uses to store output and intermediate states of build tasks. - Lockfile -
.dev/elide.build.binand.dev/elide.lock.v2.binare read-only binary files used by Elide tooling. Generally, users shouldn't edit them.
Project CLI
There are three CLI commands that can depend on an Elide project to work, which they can access in two ways:
- Direct passing - by passing
--project PATHyou can specify the manifest that will be loaded for this command. - Auto-detection - if no path is provided, the command will attempt to find a project manifest in the current directory.
As such a plain call of,
elide buildwill attempt to search for manifest in a local directory, while
elide build -p PATHwill try to fetch the manifest from the path.
These are the commands that require a project.| Command | Description |
|---|---|
build | Installs dependencies and compiles sources. |
install | Install dependencies. |
classpath | Generates a classpath for the project. |
Building a Project
elide build is the main way to build projects. It generates a task graph based on the manifest configuration.
It's possible to view a full list of tasks that a build command generates from the project manifest.
elide build --inspectTo run a specific task,
elide build TASKFor example,
elide build :compile-java-mainElide Project Manifest
elide.pkl is a Pkl-based manifest that allows for extensive configuration of Elide project.
The project manifest has a regimented, yet flexible structure.
# Importing project schema
amends "elide:project.pkl"
# Importing configuration-specific schema
import "elide:Sources.pkl" as Src
# Project metadata
name = "project"
version = "1.0.0"
description = "example project"
# Project configuration
sources {
["main"] = new Src.SourceSetSpec {
paths {
"src/main/java<<>>*.java"
}
}
}Project Metadata
Top-level declarations for project organization and house keeping.| Field | Type | Default | Description |
|---|---|---|---|
name | String | Empty | Name of the project. |
version | String | Empty | Project version number. |
description | String | Empty | Description of the project. |
Sources
For Elide project to build, sources have to be specified in the manifest. A general template of declaring sources is
import "elide:Sources.pkl" as Src
sources {
["main"] = new Src.SourceSetSpec {
paths {
"src/main/java<<>>*.java"
}
}
}The import allows you to use source schema and helps Elide to parse the source section of the manifest.
Sources themselves are declared by paths, which are a list of pattern-matched paths.
sources section, sources are grouped by sets and assigned to specific source types, such as ["main"] in this example. There are 2 set types that Elide recognizes which results in different build graphs generated during elide build.
| Type | Description |
|---|---|
main | Set of main sources. |
test | Set of test sources. |
Entrypoint
Specifying an entrypoint allows Elide to automatically detect scripts to run.
entrypoint {
"some.entry"
}As such if during elide run no script was specified, Elide will attempt to fetch an entrypoint filepath from the manifest.
Scripts
Scripts are key value pairs, intended to work similar to scripts of Node's package.json.
If elide run receives a non-option argument that matches the name of a script, the script is executed instead of the parameter being interpreted as a path.
For example, if you specify in script
scripts {
["help"] = "elide --help"
}elide run help will produce an output similar to elide --help.
Dependencies
Elide comes with an in-built dependency manager.
Elide can act as a Maven installer.There are two ways to declare a Maven dependency
import "elide:Jvm.pkl" as Jvm
dependencies {
maven {
packages {
"com.google.guava:guava:33.4.8-jre",
new Jvm.MavenPackageSpec {
group = "com.google.guava"
name = "guava"
version = "33.4.8-jre"
}
}
}
}Maven dependencies are installed in your local Maven repository and linked into your project through .dev file.
| Type | Description |
|---|---|
packages | Dependencies used in the compilation and runtime classpaths. |
modules | Dependencies added to the compilation and runtime modulepath for use with Java modules. |
testPackages | Dependencies added to the compilation and runtime classpaths of test sources. |
compileOnly | Dependencies added only to the compilation classpath only. |
runtimeOnly | Dependencies used only at runtime, but not present during compilation. |
processors | Dependencies containing annotation processors. |
kotlinPlugins | Dependencies containing Kotlin compiler plugins. |
exclusions | Maven packages that should be excluded from the graph, e.g. to fix version conflicts manually. |
devPackages | Installed by elide install, but not added anywhere else, useful if you want to have things like JUnit installed for use as part of custom workflows, but not add it to your actual classpath. |
repositories | Configurations for additional remote maven repositories. |
import "elide:Jvm.pkl" as Jvm
dependencies {
maven {
repositories {
["central"] = new Jvm.MavenRepositorySpec {
name = "Maven Central"
description = "The central Maven repository"
url = "https:<<>>
}
[" google"] = "https://maven.google.com"
}
}
}Or specify a local repository and connect to maven central
dependencies {
maven {
localRepository = ".m2/repository"
}
}| Type | Description |
|---|---|
coordinates | Coordinates for this project as a library, if applicable. |
enableDefaultRepositories | Whether to enable default repositories like Maven Central. Defaults to true. |
localRepository | Path to local maven repository |
|repositories | A suite of extra Maven repositories. |
JVM
Elide has a mechanism that allows for high level of configuration of how Elide interacts with the JVM.
In order to start configuring the JVM, you have to import the JVM-specific schema.
import "elide:Jvm.pkl" as Jvm
jvm {
# your configuration here
}At the high-level, you can specify what JVM you want elide to target and specify and entry point for your JVM.
jvm {
main = "test.class"
target = "latest"
javaHome = "home"
}| Configuration | Description |
|---|---|
main | Entrypoint of JVM. |
target | JVM target level. |
javaHome | Set a custom Java Home override. |
features | Controls features and settings related to JVM support. |
java | Java language settings. |
flags | Runtime JVM flags. |
defs | Runtime definitions (system properties). |
features have two flag that control JVM support for elide
| Feature | Description |
|---|---|
testing | If Elide needs to automatically provide test dependencies for JVM projects. (Boolean) |
automodules | Whether auto-modules are enabled (JDK 9+ modulepath handling). (Boolean) |
java controls settings relating to the Java language such as compiler configuration.
| Feature | Description |
|---|---|
source | The source version to use. |
release | The release version to use. |
compiler | Controls settings relating to the Java compiler. Has two flags, mode which is used to configure what compiler to use and flags that control what flags to pass into compiler. Learn more about Elide compiler here |
flags are a set of JVM-tuning flags.
Kotlin
Elide allows to configure Kotlin behavior.
kotlin {
# your configuration here
}| Configuration | Description |
|---|---|
apiLevel | Kotlin API levels. |
languageLevel | Kotlin language target level. |
compilerOptions | Specifies options which relate to the Kotlin compiler. |
features | Specifies Kotlin-related features and options within Elide. |
toolchain | Describes a Kotlin toolchain to be used for compilation. |
plugins | Describes a set of option key-value pairs used to configure a Kotlin compiler plugin. |
compilerOptions| Option | Description |
|---|---|
optIn | Opt-ins to add to Kotlin compiler invocations. |
progressiveMode | Whether to enable the compiler's progressive mode. |
extraWarnings | Whether to enable extra K2 warnings and checks. |
allWarningsAsErrors | Report an error if there are any warnings. |
suppressWarnings | Don't generate any warnings. |
verbose | Enable verbose logging output. |
freeCompilerArgs | Arbitrary arguments to pass to the Kotlin compiler. |
apiVersion | Explicitly set an API version for Kotlin Compiler invocations; this should typically be left at the default, which allows Elide to align API version options. |
languageVersion | Explicitly set a language version for Kotlin Compiler invocations; this should typically be left at the default, which allows Elide to align language version options. |
includeRuntime | Include Kotlin runtime classes within the output artifact. |
noStdlib | Don't automatically include the Kotlin Standard Library on the classpath. |
javaParameters | Generate metadata for Java 1.8 reflection on method parameters. |
jvmTarget | Explicitly set a JVM target; typically this should be left at the default, which allows Elide to align JVM target options with Java, as applicable. |
noJdk | Don't automatically include the Java runtime on the classpath. |
jvmTargetValidationMode | Validation of JVM target compatibility between Kotlin and Java. |
features| Feature | Description |
|---|---|
kapt | Enable or disable annotation processing with kapt. |
testing | Whether to enable Kotlin's test support features. |
kotlinx | Whether to enable KotlinX dependencies automatically on the classpath. |
defaultPlugins | Whether to enable the default suite of built-in plugins for the Kotlin compiler. |
serialization | Enable or disable KotlinX serialization support. |
coroutines | Enable or disable KotlinX Coroutines support. |
reflection | Whether to enable Kotlin's reflection features. |
toolchain| Configuration | Description |
|---|---|
version | Describes a managed Kotlin toolchain using a specific version. Managed toolchains are automatically resolved and downloaded by Elide when required. |
path | Path to a local Kotlin distribution. |
plugins {
["plugin"] = {
["setting"] = "value",
}
}JavaScript
Elide allows to configure JavaScript ECMA level for the project.
javascript {
ecma = "latest"
}Native Image
Elide allows for configuration of project-wide native compiler.
In order to start configuring the native compiler, you have to import a specific schema.
import "elide:NativeImage.pkl" as NativeImage
nativeImage {
# your configuration here
}| Configuration | Description |
|---|---|
verbose | Whether to activate verbose output. |
linkAtBuildTime | Build-time linkage options. |
classInit | Class initialization options. |
exclusions | Exclusions to apply to classpath and modulepath calculations. |
optimization | Optimization level for the Native Image ("auto", "b", "s", 1 - 4). |
pgo | PGO (Profiling Guided Optimization) settings. |
driverMode | Whether to invoke Native Image internally ("embedded"), or as a sub-process ("external"). |
flags | Extra flags to pass to the Native Image compiler; added to all project targets. |
cflags | Extra flags to pass to the native C compiler; added to all project targets. |
ldflags | Extra flags to pass to the native linker; added to all project targets. |
defs | Definitions of system properties to pass during the Native Image build. |
features | Enabled compiler features. |
linkAtBuildTime| Option | Description |
|---|---|
enabled | Whether link-at-build-time is enabled as the default. |
packages | Specific packages to link at build time. |
classInit| Option | Description |
|---|---|
default | Whether initialize-at-build-time is enabled as the default (default: "buildtime" or "runtime"). |
buildtime | Specific classes or packages to initialize at build time. |
runtime | Specific classes or packages to initialize at runtime. |
exclusions| Option | Description |
|---|---|
all | Exclusions from all paths. (default list: "org.graalvm.compiler:compiler", "org.graalvm.espresso:espresso-svm", "org.graalvm.nativeimage:native-image-base", "org.graalvm.nativeimage:objectfile", "org.graalvm.nativeimage:pointsto", "org.graalvm.nativeimage:svm") |
classpath | Classpath exclusions to apply. |
modulepath | Modulepath exclusions to apply. |
pgo| Option | Description |
|---|---|
enabled | Whether PGO is enabled (only activates with present profiles). |
autoprofile | Whether to enable auto-build features for PGO. |
instrument | Whether to instrument for PGO. |
sampling | Whether to use sampling for PGO. |
profiles | PGO profiles to apply. |
Engine
This configuration is responsible for configuration of the execution engine used by Elide when running a project.
engine {
# your configuration here
}| Configuration | Description |
|---|---|
maxContexts | Sets the maximum number of guest contexts to use when running the application. Defaults to a sensible limit based on available processors. |
Dev
Dev configurations allow Elide to integrate fully into a development process of a project.
In order to start configuring dev settings, you have to import a specific schema.
import "elide:Dev.pkl" as Dev
dev {
# dev configuration here
}dev definitions
| Configuration | Description |
|---|---|
source | Project source configuration. |
mcp | Settings which apply to Model Context Protocol (MCP) servers. |
server | Development server settings for the project. |
source| Configuration | Description |
|---|---|
platform | Platform which holds this project's source ("git", "github", "gitlab", "bitbucket", any). |
project | Project name or path. |
subpath | Subpath for this project, as applicable. |
mcp| Configuration | Description |
|---|---|
resources | Additional MCP resources to be used by the project. |
registerElide | Whether to register Elide as an MCP tool. |
advice | Whether to register project advice with MCP. |
resources {
new Dev.McpResource {
# some resource config
}
}| Configuration | Description |
|---|---|
path | Path to the file. |
name | Resource name. |
description | Resource description. |
mimeType | Mime type to explicitly set; one is detected if not provided. |
server | Configuration | Description |
|---|---|
host | Host to listen on. |
port | Port to listen on. |
Toolchain
Toolchain settings let you configure which Elide engine version to use.
toolchain {
engines {
["elide"] = ">1.0.0"
}
}Artifacts
Elide can produce a variety of artifacts that can be placed into your project. These are declared as key-value pairs inside artifact configuration.
artifacts {
["some-artifact"] = {
# some artifact
}
}| Type | Description |
|---|---|
Jvm.Jar | Describes a JAR output artifact. |
Jvm.SourceJar | Describes a sources JAR artifact that packages source files. |
Jvm.JavadocJar | Describes a Javadoc JAR artifact that generates and packages documentation. |
NativeImage.NativeImage | Describes a Native Image artifact within an Elide project. |
Web.StaticSite | Declares a static website as an artifact. |
Jvm.Jar,
import "elide:Jvm.pkl" as Jvm
artifacts {
["some-jar"] = new Jvm.Jar {
# some config here
}
}When you want to use a source in an artifact, you have to use them by name that are already declared by in project metadata. For example, you can use main in artifact sources, if they are declared in metadata.
Jvm.Jar| Configuration | Description |
|---|---|
name | Filename for the resulting JAR. |
sources | Which source set to build this JAR from. |
resources | Which resources to add to the JAR (key-value pair of name to path). |
manifest | Keys and values to include in the JAR's manifest. |
manifestFile | Manifest file path. |
excludes | Patterns to exclude. |
options | Options for the JAR. |
option| Option | Description |
|---|---|
compress | Whether to apply compression. |
defaultManifestProperties | Whether to add default manifest properties. |
entrypoint | Main entrypoint for the JAR, if applicable. |
Jvm.SourceJar| Configuration | Description |
|---|---|
sources | Which source set to build this JAR from. |
classifier | Classifier for the JAR. |
excludes | Patterns to exclude from the sources JAR. |
includes | Patterns to include in the sources JAR. |
Jvm.JavadocJar| Configuration | Description |
|---|---|
sources | Which source set to build this JAR from. |
NativeImage.NativeImage| Configuration | Description |
|---|---|
sources | Which source set to build this JAR from. |
Web.StaticSite| Configuration | Description |
|---|---|
srcs | Path to the root source directory for the site. |
domain | Production domain to use for this site. |
prefix | Web prefix where this site is mounted; considered for links and assets. Must end with a slash. |
assets | Public web path to use for public assets for this site. |
stylesheets | Stylesheets to add to all pages. |
scripts | Scripts to add to all pages. |
hosting | Static site host. |
Web
This configuration describes settings which apply in web-based environments; these settings configure how Elide builds and serves web applications, and related resources like images, stylesheets, and JavaScript.| Configuration | Description |
|---|---|
css | Settings to apply to CSS processing and serving. If both browsers and css.targets are specified, the CSS suite wins at build-time. |
browsers | Browser support for this project, which applies to all built targets. |
css| Configuration | Description |
|---|---|
minify | Whether to enable minification of CSS code. |
targets | Target platforms (browsers) to consider when rendering/building CSS. |
import "elide:Web.pkl" as Web
web {
css {
targets {
new Web.CssTarget {
# some config
}
}
}
}target| Configuration | Description |
|---|---|
browser | The name of the browser type to target("chrome", "firefox", "safari", "edge", "opera", String). |
version | The version of the browser to target. |
Elide Lockfile
Elide lockfile contains information about project metadata as well as a resolved dependency graph. It allows for faster elide build as unmodified dependency list will be skipped and resolved dependency graph will be used