Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions .github/workflows/job.build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ jobs:
java-version: "24"
- name: "Setup: Elide"
uses: elide-dev/setup-elide@990b915b2974a70e7654acb1303607b4cd1d3538 # v2.0.0
- name: "Build: Plugin"
run: ./gradlew build publishToMavenLocal
- name: "Test: Plugin"
working-directory: sample
run: ./mvnw clean package
- name: "Build: Java Compiler"
run: ./mvnw clean install -pl plexus-compilers
- name: "Build: Kotlin Plugin"
run: ./mvnw clean install -pl kotlin-plugin
- name: "Test: Java Compiler"
run: ./mvnw clean package -pl sample-java
- name: "Test: Kotlin Plugin"
run: ./mvnw clean package -pl sample-kotlin
- name: "Test: Mixed source"
run: ./mvnw clean package -pl sample-mixed
2 changes: 1 addition & 1 deletion .github/workflows/on.pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: "PR"

"on":
pull_request: {}
pull_request: { }

permissions:
contents: "read"
Expand Down
21 changes: 7 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Kotlin ###
.kotlin

### Eclipse ###
.apt_generated
Expand All @@ -24,16 +17,16 @@ out/
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
Expand Down
182 changes: 154 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Elide Maven Plugin

This plugin can be consumed in a Maven project to use [Elide](https://elide.dev).
This plugin can be consumed in a Maven project to use [Elide](https://elide.dev) for compiling Java and Kotlin sources.

> [!WARNING]
> This plugin is currently under development.
Expand All @@ -9,44 +9,170 @@ This plugin can be consumed in a Maven project to use [Elide](https://elide.dev)

- [x] Swap out `javac ...` for `elide javac -- ...`
- [x] Supports explicit path to `elide`
- [ ] Resolve `elide` via the `PATH`
- [ ] Swap out `kotlinc ...` for `elide kotlinc -- ...`
- [x] Resolve `elide` via the `PATH`
- [x] Swap out `kotlinc ...` for `elide kotlinc -- ...`
- [ ] Usability of Elide as a Maven toolchain

## Usage

### Java

Configuring Elide as your `javac` compiler:

**`pom.xml`**
```xml
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<dependencies>
<dependency>
<groupId>dev.elide</groupId>
<artifactId>elide-plexus-compilers</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
<configuration>
<compilerId>elide</compilerId>
</configuration>
</plugin>
</plugins>
</build>
<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]
> See the [Java sample project](sample-java) for a usage example. Elide also provides
> a [Gradle plugin](https://github.com/elide-dev/gradle).

### Kotlin

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>
```

Properties needed:
> [!TIP]
> See the [Kotlin sample project](sample-kotlin) for a usage example.

### Mixed Java and Kotlin

By combining the Kotlin configuration and Java compiler replacement, mixed Java and Kotlin sources can be compiled with
Elide:

**`pom.xml`**

```xml
<properties>
<maven.compiler.source>24</maven.compiler.source>
<maven.compiler.target>24</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<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>
```

> [!TIP]
> See the [sample project](./sample) for a usage example. Elide also provides a [Gradle plugin](https://github.com/elide-dev/gradle).
> See the [Mixed sources sample project](sample-mixed) for a usage example.
49 changes: 0 additions & 49 deletions build.gradle.kts

This file was deleted.

1 change: 0 additions & 1 deletion gradle.properties

This file was deleted.

9 changes: 0 additions & 9 deletions gradle/libs.versions.toml

This file was deleted.

Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
6 changes: 0 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Loading