Skip to content

POM export

Hand an Elide project to Maven and other tools with elide project export (POM, JSON, IntelliJ model), and build the result with Maven.

Read offlineelide help build-tools-export

On this page

elide project export renders an elide.pkl project as a model other tools read. --format=pom writes a Maven pom.xml, which any Maven 3.9+ install builds.

Export

Terminal
bash
elide project export --format=pom > pom.xml
elide project export --format=json          # resolved manifest
elide project export --format=intellij      # IntelliJ workspace model
elide project export -p app --format=pom    # another project directory

Pass the format as --format=<value>; the output goes to stdout.

Format Contents
json (default) The manifest after Pkl evaluation
pom A Maven POM: coordinates, dependencies with scopes, compiler release, source roots
intellij Modules per source set, content and source roots, library dependencies, JDK level

What the POM contains

elide.pkl pom.xml
name <groupId>, <artifactId> and <name> (a workspace member takes the workspace name as <groupId>)
version <version>; 0.0.0 when unset
jvm.target, jvm.java.release maven.compiler.release, .source, .target
packages, modules compile scope
compileOnly, devPackages, processors provided
runtimeOnly runtime
testPackages test
A local JAR path system scope with ${project.basedir} path
Source sets <sourceDirectory>, <testSourceDirectory>; extra roots through build-helper-maven-plugin
Workspace members <modules> on the root, <parent> on each member
A Jar.from sibling Its packages, modules and runtimeOnly, unless already listed

Not exported: exclusions, substitutions and kotlinPlugins. Repositories declared in the manifest are exported. An Android project’s src/androidTest and its androidTestPackages are left out too: those tests run on a device from a test APK, and Maven’s test scope is the host’s.

In the IntelliJ model, the androidTest module is a test module that sees the production dependencies and androidTestPackages at TEST scope; the test module sees testPackages, never androidTestPackages.

Build the POM

Point JAVA_HOME at the directory that holds bin/elide; its bin/java and bin/javac run Maven, its compiler and its forked test JVMs as a JDK 25 would:

Terminal
bash
export JAVA_HOME="$(dirname "$(dirname "$(readlink -f "$(command -v elide)")")")"
mvn package

To compile with elide javac and elide kotlinc inside an existing POM, use the Maven plugin.

Example

pkl
amends "elide:project.pkl"

name = "hello"
version = "1.0.0"

dependencies {
  maven {
    packages { "com.google.guava:guava:33.4.8-jre" }
    testPackages { "org.junit.jupiter:junit-jupiter:5.13.4" }
  }
}

jvm {
  main = "com.example.Hello"
  target = 17
}
utf-8 · pkl · Lines: 16
Terminal
bash
elide project export --format=pom > pom.xml
xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>hello</groupId>
  <artifactId>hello</artifactId>
  <version>1.0.0</version>
  <name>hello</name>
  <properties>
    <maven.compiler.release>17</maven.compiler.release>
    <maven.compiler.target>17</maven.compiler.target>
    <maven.compiler.source>17</maven.compiler.source>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>33.4.8-jre</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.13.4</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <sourceDirectory>src/main/java</sourceDirectory>
    <testSourceDirectory>src/test/java</testSourceDirectory>
  </build>
</project>
utf-8 · xml · Lines: 30

Limits

  • The export is one-way: Elide never reads the generated file back. Regenerate it after changing elide.pkl.
  • name becomes the coordinates. A name with spaces or other characters Maven rejects needs a hand-edited <groupId> and <artifactId>.
  • Only build-helper-maven-plugin is declared. Kotlin sources need a Kotlin compiler added to the build, such as Elide’s.
  • Elide’s built-in test dependencies are not added; declare test frameworks in testPackages.

Was this page helpful?