Elide Maven Plugin

Maven Plugin is in experimental stages. The installation steps will soon change.

You can use Elide to build within Maven via a plugin.

Elide builds javac as a native image and includes it within the Elide binary. This plugin changes your Maven build to use Elide's toolchain facilities instead of Maven's built-in ones.

The result can be a significant performance improvement for code compilation.

Before you start

You'll need an installed copy of Elide. Follow the Installation guide to obtain a copy of Elide.

Installation

1. Clone plugin's git repository:

git clone git@github.com:elide-dev/maven.git elide-maven-plugin

2. Add the plugin to your local Maven repository:

cd elide-maven-plugin

mvn install -pl plexus-compilers
# or
./mvnw install -pl plexus-compilers

3. To also install the Kotlin plugin, include the kotlin-plugin module:

mvn install -pl plexus-compilers,kotlin-plugin
# or
./mvnw install -pl plexus-compilers,kotlin-plugin

Usage

Compiling with Elide in Java project.

Elide acts as a full drop-in replacement for javac.

To enable Elide compilation in Maven project, configure your pom.xml:

pom.xml
xml
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.14.0</version>
            <dependencies>
                <dependency>
                    <groupId>dev.elide</groupId>
                    <artifactId>elide-plexus-compilers</artifactId>
                    <version>1.0.0</version>
                </dependency>
            </dependencies>
            <configuration>
                <compilerId>elide</compilerId>
            </configuration>
        </plugin>
    </plugins>
</build>
Tip: Sample

See the Java sample project for a usage example.

Compiling with Elide in Kotlin project.

Elide acts as a full drop-in replacement for kotlinc.

Configuring the Elide Kotlin plugin is done the exact same way as configuring the Kotlin Maven plugin, just replacing the plugin coordinates:

pom.xml
xml
<build>
    <sourceDirectory>src/main/kotlin</sourceDirectory>
    <testSourceDirectory>src/test/kotlin</testSourceDirectory>
    <plugins>
        <plugin>
            <groupId>dev.elide</groupId>
            <artifactId>elide-kotlin-maven-plugin</artifactId>
            <version>1.0.0</version>
            <executions>
                <execution>
                    <id>compile</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>test-compile</id>
                    <goals>
                        <goal>test-compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib</artifactId>
        <version>2.2.0</version>
    </dependency>
</dependencies>
Tip: Sample

See the Kotlin sample project for a usage example.

Compiling with Elide in mix-language project.

It's possible to use Elide as a build tool for mix-language Kotlin and Java projects. To do so, combine Kotlin configuration and Java compilation.

pom.xml
xml
<build>
    <plugins>
        <plugin>
            <groupId>dev.elide</groupId>
            <artifactId>elide-kotlin-maven-plugin</artifactId>
            <version>1.0.0</version>
            <executions>
                <execution>
                    <id>compile</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                    <configuration>
                        <sourceDirs>
                            <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                            <sourceDir>${project.basedir}/src/main/java</sourceDir>
                        </sourceDirs>
                    </configuration>
                </execution>
                <execution>
                    <id>test-compile</id>
                    <goals>
                        <goal>test-compile</goal>
                    </goals>
                    <configuration>
                        <sourceDirs>
                            <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
                            <sourceDir>${project.basedir}/src/test/java</sourceDir>
                        </sourceDirs>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.14.0</version>
            <dependencies>
                <dependency>
                    <groupId>dev.elide</groupId>
                    <artifactId>elide-plexus-compilers</artifactId>
                    <version>1.0.0</version>
                </dependency>
            </dependencies>
            <configuration>
                <compilerId>elide</compilerId>
            </configuration>
            <executions>
                <execution>
                    <id>default-compile</id>
                    <phase>none</phase>
                </execution>
                <execution>
                    <id>default-testCompile</id>
                    <phase>none</phase>
                </execution>
                <execution>
                    <id>java-compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
                <execution>
                    <id>java-test-compile</id>
                    <phase>test-compile</phase>
                    <goals>
                        <goal>testCompile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>