11# Elide Maven Plugin
22
3- This plugin can be consumed in a Maven project to use [ Elide] ( https://elide.dev ) .
3+ This plugin can be consumed in a Maven project to use [ Elide] ( https://elide.dev ) for compiling Java and Kotlin sources .
44
55> [ !WARNING]
66> This plugin is currently under development.
@@ -9,44 +9,170 @@ This plugin can be consumed in a Maven project to use [Elide](https://elide.dev)
99
1010- [x] Swap out ` javac ... ` for ` elide javac -- ... `
1111- [x] Supports explicit path to ` elide `
12- - [ ] Resolve ` elide ` via the ` PATH `
13- - [ ] Swap out ` kotlinc ... ` for ` elide kotlinc -- ... `
12+ - [x ] Resolve ` elide ` via the ` PATH `
13+ - [x ] Swap out ` kotlinc ... ` for ` elide kotlinc -- ... `
1414- [ ] Usability of Elide as a Maven toolchain
1515
1616## Usage
1717
18+ ### Java
19+
1820Configuring Elide as your ` javac ` compiler:
1921
2022** ` pom.xml ` **
2123``` xml
22- <build >
23- <plugins >
24- <plugin >
25- <artifactId >maven-compiler-plugin</artifactId >
26- <version >3.13.0</version >
27- <dependencies >
28- <dependency >
29- <groupId >dev.elide</groupId >
30- <artifactId >elide-plexus-compilers</artifactId >
31- <version >1.0.0-SNAPSHOT</version >
32- </dependency >
33- </dependencies >
34- <configuration >
35- <compilerId >elide</compilerId >
36- </configuration >
37- </plugin >
38- </plugins >
39- </build >
24+ <build >
25+ <plugins >
26+ <plugin >
27+ <artifactId >maven-compiler-plugin</artifactId >
28+ <version >3.14.0</version >
29+ <dependencies >
30+ <dependency >
31+ <groupId >dev.elide</groupId >
32+ <artifactId >elide-plexus-compilers</artifactId >
33+ <version >1.0.0</version >
34+ </dependency >
35+ </dependencies >
36+ <configuration >
37+ <compilerId >elide</compilerId >
38+ </configuration >
39+ </plugin >
40+ </plugins >
41+ </build >
42+ ```
43+
44+ > [ !TIP]
45+ > See the [ Java sample project] ( sample-java ) for a usage example. Elide also provides
46+ > a [ Gradle plugin] ( https://github.com/elide-dev/gradle ) .
47+
48+ ### Kotlin
49+
50+ Configuring the Elide Kotlin plugin is done the exact same way as configuring the Kotlin Maven plugin, just replacing
51+ the plugin coordinates:
52+
53+ ** ` pom.xml ` **
54+ ``` xml
55+ <build >
56+ <sourceDirectory >src/main/kotlin</sourceDirectory >
57+ <testSourceDirectory >src/test/kotlin</testSourceDirectory >
58+ <plugins >
59+ <plugin >
60+ <groupId >dev.elide</groupId >
61+ <artifactId >elide-kotlin-maven-plugin</artifactId >
62+ <version >1.0.0</version >
63+ <executions >
64+ <execution >
65+ <id >compile</id >
66+ <goals >
67+ <goal >compile</goal >
68+ </goals >
69+ </execution >
70+ <execution >
71+ <id >test-compile</id >
72+ <goals >
73+ <goal >test-compile</goal >
74+ </goals >
75+ </execution >
76+ </executions >
77+ </plugin >
78+ </plugins >
79+ </build >
80+
81+ <dependencies >
82+ <dependency >
83+ <groupId >org.jetbrains.kotlin</groupId >
84+ <artifactId >kotlin-stdlib</artifactId >
85+ <version >2.2.0</version >
86+ </dependency >
87+ </dependencies >
4088```
4189
42- Properties needed:
90+ > [ !TIP]
91+ > See the [ Kotlin sample project] ( sample-kotlin ) for a usage example.
92+
93+ ### Mixed Java and Kotlin
94+
95+ By combining the Kotlin configuration and Java compiler replacement, mixed Java and Kotlin sources can be compiled with
96+ Elide:
97+
98+ ** ` pom.xml ` **
99+
43100``` xml
44- <properties >
45- <maven .compiler.source>24</maven .compiler.source>
46- <maven .compiler.target>24</maven .compiler.target>
47- <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
48- </properties >
101+ <build >
102+ <plugins >
103+ <plugin >
104+ <groupId >dev.elide</groupId >
105+ <artifactId >elide-kotlin-maven-plugin</artifactId >
106+ <version >1.0.0</version >
107+ <executions >
108+ <execution >
109+ <id >compile</id >
110+ <goals >
111+ <goal >compile</goal >
112+ </goals >
113+ <configuration >
114+ <sourceDirs >
115+ <sourceDir >${project.basedir}/src/main/kotlin</sourceDir >
116+ <sourceDir >${project.basedir}/src/main/java</sourceDir >
117+ </sourceDirs >
118+ </configuration >
119+ </execution >
120+ <execution >
121+ <id >test-compile</id >
122+ <goals >
123+ <goal >test-compile</goal >
124+ </goals >
125+ <configuration >
126+ <sourceDirs >
127+ <sourceDir >${project.basedir}/src/test/kotlin</sourceDir >
128+ <sourceDir >${project.basedir}/src/test/java</sourceDir >
129+ </sourceDirs >
130+ </configuration >
131+ </execution >
132+ </executions >
133+ </plugin >
134+ <plugin >
135+ <groupId >org.apache.maven.plugins</groupId >
136+ <artifactId >maven-compiler-plugin</artifactId >
137+ <version >3.14.0</version >
138+ <dependencies >
139+ <dependency >
140+ <groupId >dev.elide</groupId >
141+ <artifactId >elide-plexus-compilers</artifactId >
142+ <version >1.0.0</version >
143+ </dependency >
144+ </dependencies >
145+ <configuration >
146+ <compilerId >elide</compilerId >
147+ </configuration >
148+ <executions >
149+ <execution >
150+ <id >default-compile</id >
151+ <phase >none</phase >
152+ </execution >
153+ <execution >
154+ <id >default-testCompile</id >
155+ <phase >none</phase >
156+ </execution >
157+ <execution >
158+ <id >java-compile</id >
159+ <phase >compile</phase >
160+ <goals >
161+ <goal >compile</goal >
162+ </goals >
163+ </execution >
164+ <execution >
165+ <id >java-test-compile</id >
166+ <phase >test-compile</phase >
167+ <goals >
168+ <goal >testCompile</goal >
169+ </goals >
170+ </execution >
171+ </executions >
172+ </plugin >
173+ </plugins >
174+ </build >
49175```
50176
51177> [ !TIP]
52- > See the [ sample project] ( ./ sample) for a usage example. Elide also provides a [ Gradle plugin ] ( https://github.com/elide-dev/gradle ) .
178+ > See the [ Mixed sources sample project] ( sample-mixed ) for a usage example.
0 commit comments