From dcccd4c2510dbe434f379db44d9be69600b19f96 Mon Sep 17 00:00:00 2001 From: melodicore Date: Mon, 4 May 2026 11:53:43 +0300 Subject: [PATCH 01/19] fix: actually search from path Signed-off-by: melodicore --- .../src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt index 0ee1bec..0e3c866 100644 --- a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt +++ b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt @@ -35,7 +35,7 @@ object ElideLocator { */ fun locate(): Path? { val path = System.getenv("PATH") ?: "" - for (pathCandidate in path.split(File.separatorChar)) { + for (pathCandidate in path.split(':')) { val candidate = Paths.get(pathCandidate, "elide") if (isValidElideBinary(candidate)) { return candidate From a9ee842c1108d703292323dc6045333d5e3e5ac8 Mon Sep 17 00:00:00 2001 From: melodicore Date: Mon, 4 May 2026 11:57:53 +0300 Subject: [PATCH 02/19] fix: use elide.exe on windows Signed-off-by: melodicore --- .../main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt | 3 ++- .../src/main/kotlin/dev/elide/maven/compiler/Constants.kt | 3 +++ .../main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt | 2 +- .../src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt | 3 +-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt index 364a00d..3a95bf0 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt @@ -12,6 +12,7 @@ */ package dev.elide.maven.plugin.kotlin +import dev.elide.maven.compiler.ELIDE_EXECUTABLE import dev.elide.maven.compiler.ElideLocator import org.apache.maven.project.MavenProject import org.codehaus.plexus.compiler.CompilerException @@ -52,7 +53,7 @@ object ElideRunner { arguments.freeArgs = freeArgs val cli = Commandline() cli.workingDirectory = project.basedir - cli.executable = executable ?: ElideLocator.locate()?.absolutePathString() ?: "elide" + cli.executable = executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE cli.addArguments(ArgumentParser.parseArguments(compiler, arguments, project, java)) val out = CommandLineUtils.StringStreamConsumer() var returnCode: Int diff --git a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/Constants.kt b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/Constants.kt index 1131d0d..b88b294 100644 --- a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/Constants.kt +++ b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/Constants.kt @@ -16,3 +16,6 @@ package dev.elide.maven.compiler * Constant ID used by the Elide compiler shim. */ public const val ELIDE_COMPILER: String = "elide" + +public val ELIDE_EXECUTABLE: String = + if (System.getProperty("os.name").contains("windows", true)) "elide.exe" else "elide" diff --git a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt index ca47697..b8d6474 100644 --- a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt +++ b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt @@ -83,7 +83,7 @@ public open class ElideJavacCompiler() : AbstractCompiler( private fun getElideExecutable(config: CompilerConfiguration): String = when (val executable = config.executable) { null -> ElideLocator.locate()?.absolutePathString() else -> executable - } ?: "elide" + } ?: ELIDE_EXECUTABLE override fun createCommandLine(config: CompilerConfiguration): Array { return buildElideArgs(config, getSourceFiles(config)).toTypedArray() diff --git a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt index 0e3c866..0a78d76 100644 --- a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt +++ b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt @@ -12,7 +12,6 @@ */ package dev.elide.maven.compiler -import java.io.File import java.nio.file.Path import java.nio.file.Paths @@ -36,7 +35,7 @@ object ElideLocator { fun locate(): Path? { val path = System.getenv("PATH") ?: "" for (pathCandidate in path.split(':')) { - val candidate = Paths.get(pathCandidate, "elide") + val candidate = Paths.get(pathCandidate, ELIDE_EXECUTABLE) if (isValidElideBinary(candidate)) { return candidate } From 469856c5395f2964cb103e1e5c902f7e7bb65ef4 Mon Sep 17 00:00:00 2001 From: melodicore Date: Mon, 4 May 2026 20:22:44 +0300 Subject: [PATCH 03/19] feat: kotlin plugin extensions Signed-off-by: melodicore --- README.md | 66 +----- kotlin-plugin/pom.xml | 10 + .../kotlin/ElideKotlinLifecycleParticipant.kt | 127 +++++++++++ .../resources/META-INF/plexus/components.xml | 206 ++++++++++++++++++ .../maven/compiler/ElideJavacCompiler.kt | 6 +- sample-kotlin/README.md | 17 +- sample-kotlin/pom.xml | 25 +-- sample-mixed/README.md | 54 +---- sample-mixed/pom.xml | 59 +---- 9 files changed, 353 insertions(+), 217 deletions(-) create mode 100644 kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt create mode 100644 kotlin-plugin/src/main/resources/META-INF/plexus/components.xml diff --git a/README.md b/README.md index 92b53eb..5b2448c 100644 --- a/README.md +++ b/README.md @@ -60,20 +60,7 @@ the plugin coordinates: dev.elide elide-kotlin-maven-plugin 1.0.0 - - - compile - - compile - - - - test-compile - - test-compile - - - + true @@ -96,32 +83,7 @@ Elide: dev.elide elide-kotlin-maven-plugin 1.0.0 - - - compile - - compile - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/main/java - - - - - test-compile - - test-compile - - - - ${project.basedir}/src/test/kotlin - ${project.basedir}/src/test/java - - - - + true org.apache.maven.plugins @@ -137,30 +99,6 @@ Elide: elide - - - default-compile - none - - - default-testCompile - none - - - java-compile - compile - - compile - - - - java-test-compile - test-compile - - testCompile - - - diff --git a/kotlin-plugin/pom.xml b/kotlin-plugin/pom.xml index 8a0b829..f0cb6cd 100644 --- a/kotlin-plugin/pom.xml +++ b/kotlin-plugin/pom.xml @@ -60,6 +60,16 @@ + + + src/main/resources + true + + **/* + + + + org.apache.maven.plugins diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt new file mode 100644 index 0000000..eea0f08 --- /dev/null +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt @@ -0,0 +1,127 @@ +package dev.elide.maven.plugin.kotlin + +import org.apache.maven.AbstractMavenLifecycleParticipant +import org.apache.maven.MavenExecutionException +import org.apache.maven.execution.MavenSession +import org.apache.maven.model.Dependency +import org.apache.maven.model.Plugin +import org.apache.maven.project.MavenProject +import org.codehaus.plexus.logging.LogEnabled +import org.codehaus.plexus.logging.Logger +import org.codehaus.plexus.util.xml.Xpp3Dom +import java.io.File + +/** @author Lauri Heino */ +class ElideKotlinLifecycleParticipant : AbstractMavenLifecycleParticipant(), LogEnabled { + private var logger: Logger? = null + + override fun enableLogging(logger: Logger?) { + this.logger = logger + } + + @Throws(MavenExecutionException::class) + override fun afterProjectsRead(session: MavenSession) { + for (project in session.projects) { + val plugin = getKotlinMavenPlugin(project) + if (plugin != null && isExtensionsEnabled(plugin) && isSmartDefaultsEnabled(project)) { + configureSmartDefaults(project, plugin) + } + } + } + + private fun isSmartDefaultsEnabled(project: MavenProject): Boolean { + // System property has priority + val sysProp = System.getProperty(SMART_DEFAULTS_ENABLED_PROPERTY) + if (sysProp != null) { + return sysProp.toBoolean() + } + + // Then check project properties + val projectProp = project.properties.getProperty(SMART_DEFAULTS_ENABLED_PROPERTY) + if (projectProp != null) { + return projectProp.toBoolean() + } + + // Enabled by default (when extensions=true) + return true + } + + private fun configureSmartDefaults(project: MavenProject, plugin: Plugin) { + logger?.info("Kotlin smart defaults are enabled for " + project.artifactId) + + addSourceRoots(project, plugin) + addStdlibDependency(project) + } + + private fun addSourceRoots(project: MavenProject, plugin: Plugin) { + if (hasUserDefinedSourceDirs(plugin)) { + return + } + + val baseDir = project.basedir + + val mainKotlinSource = File(baseDir, "src/main/kotlin") + if (mainKotlinSource.exists()) { + project.addCompileSourceRoot(mainKotlinSource.absolutePath) + } + + val testKotlinSource = File(baseDir, "src/test/kotlin") + if (testKotlinSource.exists()) { + project.addTestCompileSourceRoot(testKotlinSource.absolutePath) + } + } + + private fun hasUserDefinedSourceDirs(plugin: Plugin): Boolean { + val configuration = plugin.configuration + if (configuration is Xpp3Dom) { + val sourceDirs = configuration.getChild("sourceDirs") + return sourceDirs != null && sourceDirs.getChildCount() > 0 + } + return false + } + + private fun addStdlibDependency(project: MavenProject) { + if (hasStdlibDependency(project)) { + return + } + + val stdlib = Dependency() + stdlib.groupId = KOTLIN_GROUP_ID + stdlib.artifactId = KOTLIN_STDLIB_ARTIFACT_ID + stdlib.version = KOTLIN_VERSION + project.dependencies.add(stdlib) + + logger?.info("Added kotlin-stdlib dependency, version $KOTLIN_VERSION") + } + + private fun hasStdlibDependency(project: MavenProject): Boolean { + for (dependency in project.dependencies) { + if (KOTLIN_GROUP_ID == dependency.groupId && KOTLIN_STDLIB_ARTIFACT_ID == dependency.artifactId) { + return true + } + } + return false + } + + private fun getKotlinMavenPlugin(project: MavenProject): Plugin? { + for (plugin in project.getBuildPlugins()) { + if (PLUGIN_GROUP_ID == plugin.groupId && PLUGIN_ARTIFACT_ID == plugin.artifactId) { + return plugin + } + } + return null + } + + private fun isExtensionsEnabled(plugin: Plugin): Boolean { + return plugin.extensions.toString().toBoolean() + } + + companion object { + private const val PLUGIN_GROUP_ID = "dev.elide" + private const val PLUGIN_ARTIFACT_ID = "elide-kotlin-maven-plugin" + private const val KOTLIN_GROUP_ID = "org.jetbrains.kotlin" + private const val KOTLIN_STDLIB_ARTIFACT_ID = "kotlin-stdlib" + private const val SMART_DEFAULTS_ENABLED_PROPERTY = "kotlin.smart.defaults.enabled" + private const val KOTLIN_VERSION = "2.3.21" + } +} diff --git a/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml b/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 0000000..4ffd538 --- /dev/null +++ b/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,206 @@ + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + jar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-jar-plugin:3.3.0:jar + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy + + + + + + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + ejb + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-ejb-plugin:3.2.1:ejb + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + + + + + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + war + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-war-plugin:2.2:war + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + + + + + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + rar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-rar-plugin:3.0.0:rar + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + + + + + + + + + org.apache.maven.AbstractMavenLifecycleParticipant + kotlin + dev.elide.maven.plugin.kotlin.ElideKotlinLifecycleParticipant + + + \ No newline at end of file diff --git a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt index b8d6474..09b4100 100644 --- a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt +++ b/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt @@ -80,10 +80,8 @@ public open class ElideJavacCompiler() : AbstractCompiler( return CompilerResult(returnCode == 0, messages) } - private fun getElideExecutable(config: CompilerConfiguration): String = when (val executable = config.executable) { - null -> ElideLocator.locate()?.absolutePathString() - else -> executable - } ?: ELIDE_EXECUTABLE + private fun getElideExecutable(config: CompilerConfiguration): String = + config.executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE override fun createCommandLine(config: CompilerConfiguration): Array { return buildElideArgs(config, getSourceFiles(config)).toTypedArray() diff --git a/sample-kotlin/README.md b/sample-kotlin/README.md index 78636bb..ea157bc 100644 --- a/sample-kotlin/README.md +++ b/sample-kotlin/README.md @@ -2,7 +2,7 @@ This project demonstrates use of Elide as a Kotlin compiler within a Maven project. This is a drop-in replacement for the Kotlin plugin, so configure your Kotlin project like normal, but use `dev.elide:elide-kotlin-maven-plugin` instead -of `org.jetbrains.kotlin:kotlin-maven-plugin`. Use of `` is not supported yet. +of `org.jetbrains.kotlin:kotlin-maven-plugin`. **`pom.xml`** ```xml @@ -14,20 +14,7 @@ of `org.jetbrains.kotlin:kotlin-maven-plugin`. Use of `` is not supp dev.elide elide-kotlin-maven-plugin 1.0.0 - - - compile - - compile - - - - test-compile - - test-compile - - - + true diff --git a/sample-kotlin/pom.xml b/sample-kotlin/pom.xml index 43c5e85..ac5d1db 100644 --- a/sample-kotlin/pom.xml +++ b/sample-kotlin/pom.xml @@ -22,31 +22,8 @@ dev.elide elide-kotlin-maven-plugin 1.0.0 - - - compile - - compile - - - - - test-compile - - test-compile - - - + true - - - - org.jetbrains.kotlin - kotlin-stdlib - 2.3.21 - - - \ No newline at end of file diff --git a/sample-mixed/README.md b/sample-mixed/README.md index 6d7803c..a1653ae 100644 --- a/sample-mixed/README.md +++ b/sample-mixed/README.md @@ -3,8 +3,7 @@ This project demonstrates use of Elide as a Java and Kotlin compiler within a Maven project. This is a drop-in replacement for the Kotlin plugin, so configure your Kotlin project like normal, but use `dev.elide:elide-kotlin-maven-plugin` instead of `org.jetbrains.kotlin:kotlin-maven-plugin`, add -`elide-plexus-compilers` as a dependency to the `maven-compiler-plugin` and configure `compilerId` to `elide`. Use of -Kotlin plugin `` is not supported yet. +`elide-plexus-compilers` as a dependency to the `maven-compiler-plugin` and configure `compilerId` to `elide`. **`pom.xml`** ```xml @@ -14,32 +13,7 @@ Kotlin plugin `` is not supported yet. dev.elide elide-kotlin-maven-plugin 1.0.0 - - - compile - - compile - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/main/java - - - - - test-compile - - test-compile - - - - ${project.basedir}/src/test/kotlin - ${project.basedir}/src/test/java - - - - + true org.apache.maven.plugins @@ -55,30 +29,6 @@ Kotlin plugin `` is not supported yet. elide - - - default-compile - none - - - default-testCompile - none - - - java-compile - compile - - compile - - - - java-test-compile - test-compile - - testCompile - - - diff --git a/sample-mixed/pom.xml b/sample-mixed/pom.xml index a93b2a9..b9b4b2b 100644 --- a/sample-mixed/pom.xml +++ b/sample-mixed/pom.xml @@ -27,32 +27,7 @@ dev.elide elide-kotlin-maven-plugin 1.0.0 - - - compile - - compile - - - - ${project.basedir}/src/main/kotlin - ${project.basedir}/src/main/java - - - - - test-compile - - test-compile - - - - ${project.basedir}/src/test/kotlin - ${project.basedir}/src/test/java - - - - + true org.apache.maven.plugins @@ -68,39 +43,7 @@ elide - - - default-compile - none - - - default-testCompile - none - - - java-compile - compile - - compile - - - - java-test-compile - test-compile - - testCompile - - - - - - - org.jetbrains.kotlin - kotlin-stdlib - 2.3.21 - - \ No newline at end of file From 163bf5774660a71ecff62c587932a90a30121dc4 Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 16:30:36 +0300 Subject: [PATCH 04/19] feat: elide maven plugin Signed-off-by: melodicore --- elide-plugin/pom.xml | 274 ++++++++++++++++++ .../elide/maven/plugin/ElideCompileMojo.java | 31 ++ .../plugin/ElideKotlinJVMCompileMojo.java | 31 ++ .../plugin/ElideKotlinJVMTestCompileMojo.java | 31 ++ .../plugin/ElideKotlinKaptJVMCompileMojo.java | 30 ++ .../ElideKotlinKaptJVMTestCompileMojo.java | 30 ++ .../maven/plugin/ElideTestCompileMojo.java | 31 ++ .../maven/plugin/ElideCompileMojoImpl.kt | 14 + .../maven/plugin/ElideLifecycleParticipant.kt | 10 + .../maven/plugin/ElideTestCompileMojoImpl.kt | 15 + .../resources/META-INF/plexus/components.xml | 206 +++++++++++++ elide-plugin/src/test/kotlin/.gitkeep | 0 .../maven/plugin/kotlin/ArgumentParser.kt | 3 +- .../kotlin/ElideKotlinJVMCompileMojoImpl.kt | 3 +- .../ElideKotlinJVMTestCompileMojoImpl.kt | 3 +- .../ElideKotlinKaptJVMCompileMojoImpl.kt | 3 +- .../ElideKotlinKaptJVMTestCompileMojoImpl.kt | 3 +- .../kotlin/ElideKotlinLifecycleParticipant.kt | 139 +++------ .../elide/maven/plugin/kotlin/ElideRunner.kt | 3 +- pom.xml | 1 + sample-java/pom.xml | 9 +- sample-mixed/pom.xml | 17 +- 22 files changed, 756 insertions(+), 131 deletions(-) create mode 100644 elide-plugin/pom.xml create mode 100644 elide-plugin/src/main/java/dev/elide/maven/plugin/ElideCompileMojo.java create mode 100644 elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMCompileMojo.java create mode 100644 elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMTestCompileMojo.java create mode 100644 elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMCompileMojo.java create mode 100644 elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMTestCompileMojo.java create mode 100644 elide-plugin/src/main/java/dev/elide/maven/plugin/ElideTestCompileMojo.java create mode 100644 elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt create mode 100644 elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideLifecycleParticipant.kt create mode 100644 elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt create mode 100644 elide-plugin/src/main/resources/META-INF/plexus/components.xml create mode 100644 elide-plugin/src/test/kotlin/.gitkeep diff --git a/elide-plugin/pom.xml b/elide-plugin/pom.xml new file mode 100644 index 0000000..37e1b98 --- /dev/null +++ b/elide-plugin/pom.xml @@ -0,0 +1,274 @@ + + + 4.0.0 + + dev.elide + elide-maven-plugin + 1.0.0 + maven-plugin + + Elide Maven Plugin + A Plugin that configures Maven to use Elide as a Java and Kotlin compiler. + https://elide.dev + + + + MIT License + https://www.opensource.org/licenses/mit-license.php + + + + + + Lauri Heino + datafox@datafox.me + Elide + https://elide.dev + + + + + scm:git:git://github.com/elide-dev/maven.git + scm:git:ssh://github.com:elide-dev/maven.git + https://github.com/elide-dev/maven/tree/main + + + + UTF-8 + official + 11 + + 1.0.0 + 2.3.21 + 1 + 2.16.2 + 6.0.3 + 3.9.15 + 3.15.2 + 3.5.5 + 3.15.0 + 4.0.3 + + + + + mavenCentral + https://repo1.maven.org/maven2/ + + + + + + + src/main/resources + true + + **/* + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + ${mavenToolsVersion} + + + default-descriptor + + descriptor + + process-classes + + + help-descriptor + + helpmojo + + process-classes + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlinVersion} + + + compile + + compile + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/main/java + + + + + test-compile + + test-compile + + + + ${project.basedir}/src/test/kotlin + ${project.basedir}/src/test/java + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + ${mavenCompilerVersion} + + + dev.elide + elide-plexus-compilers + ${compilerVersion} + + + + elide + 11 + + + + default-compile + none + + + default-testCompile + none + + + java-compile + compile + + compile + + + + java-test-compile + test-compile + + testCompile + + + + + + maven-surefire-plugin + ${mavenTestPluginVersion} + + + maven-failsafe-plugin + ${mavenTestPluginVersion} + + + + + + + + + org.codehaus.plexus + plexus-utils + ${plexusUtilsVersion} + + + + + + + org.jetbrains.kotlin + kotlin-test-junit5 + ${kotlinVersion} + test + + + org.junit.jupiter + junit-jupiter + ${junitVersion} + test + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlinVersion} + + + org.apache.maven + maven-plugin-api + ${mavenVersion} + provided + + + org.apache.maven + maven-core + ${mavenVersion} + provided + + + * + * + + + + + org.apache.maven.plugin-tools + maven-plugin-annotations + ${mavenToolsVersion} + + + org.jetbrains.kotlin + kotlin-build-tools-api + ${kotlinVersion} + compile + + + org.jetbrains.kotlin + kotlin-build-tools-impl + ${kotlinVersion} + runtime + + + org.jetbrains.kotlin + kotlin-compiler-embeddable + ${kotlinVersion} + + + org.jetbrains.kotlin + kotlin-scripting-compiler-embeddable + ${kotlinVersion} + + + dev.elide + elide-plexus-compilers + ${compilerVersion} + + + javax.inject + javax.inject + ${injectVersion} + + + org.codehaus.plexus + plexus-xml + 4.1.1 + provided + + + dev.elide + elide-kotlin-maven-plugin + 1.0.0 + compile + + + \ No newline at end of file diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideCompileMojo.java new file mode 100644 index 0000000..6940f6f --- /dev/null +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideCompileMojo.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024-2025 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ +package dev.elide.maven.plugin; + +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Elide Java compiler Mojo. + * + * @author Lauri Heino + * @since 1.0.0 + */ +@Mojo( + name = "compile", + defaultPhase = LifecyclePhase.COMPILE, + threadSafe = true, + requiresDependencyResolution = ResolutionScope.COMPILE) +public class ElideCompileMojo extends ElideCompileMojoImpl { +} diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMCompileMojo.java new file mode 100644 index 0000000..84ff9eb --- /dev/null +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMCompileMojo.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024-2025 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ +package dev.elide.maven.plugin; + +import dev.elide.maven.plugin.kotlin.ElideKotlinJVMCompileMojoImpl; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Elide Kotlin to JVM compiler Mojo. + * + * @author Lauri Heino + * @since 1.0.0 + */ +@Mojo(name = "compile-kotlin", + defaultPhase = LifecyclePhase.COMPILE, + requiresDependencyResolution = ResolutionScope.COMPILE, + threadSafe = true) +public class ElideKotlinJVMCompileMojo extends ElideKotlinJVMCompileMojoImpl { +} diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMTestCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMTestCompileMojo.java new file mode 100644 index 0000000..ec847ab --- /dev/null +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMTestCompileMojo.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024-2025 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ +package dev.elide.maven.plugin; + +import dev.elide.maven.plugin.kotlin.ElideKotlinJVMTestCompileMojoImpl; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Elide Kotlin to JVM test compiler Mojo. + * + * @author Lauri Heino + * @since 1.0.0 + */ +@Mojo(name = "test-compile-kotlin", + defaultPhase = LifecyclePhase.TEST_COMPILE, + requiresDependencyResolution = ResolutionScope.TEST, + threadSafe = true) +public class ElideKotlinJVMTestCompileMojo extends ElideKotlinJVMTestCompileMojoImpl { +} diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMCompileMojo.java new file mode 100644 index 0000000..49a8436 --- /dev/null +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMCompileMojo.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024-2025 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ +package dev.elide.maven.plugin; + +import dev.elide.maven.plugin.kotlin.ElideKotlinKaptJVMCompileMojoImpl; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Elide Kotlin Kapt JVM compiler Mojo. + * + * @author Lauri Heino + * @since 1.0.0 + */ +@Mojo(name = "kapt", + defaultPhase = LifecyclePhase.PROCESS_SOURCES, + requiresDependencyResolution = ResolutionScope.COMPILE) +public class ElideKotlinKaptJVMCompileMojo extends ElideKotlinKaptJVMCompileMojoImpl { +} diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMTestCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMTestCompileMojo.java new file mode 100644 index 0000000..9eb7ea0 --- /dev/null +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMTestCompileMojo.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2024-2025 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ +package dev.elide.maven.plugin; + +import dev.elide.maven.plugin.kotlin.ElideKotlinKaptJVMTestCompileMojoImpl; +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Elide Kotlin Kapt JVM test compiler Mojo. + * + * @author Lauri Heino + * @since 1.0.0 + */ +@Mojo(name = "test-kapt", + defaultPhase = LifecyclePhase.PROCESS_TEST_SOURCES, + requiresDependencyResolution = ResolutionScope.TEST) +public class ElideKotlinKaptJVMTestCompileMojo extends ElideKotlinKaptJVMTestCompileMojoImpl { +} diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideTestCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideTestCompileMojo.java new file mode 100644 index 0000000..06c92ea --- /dev/null +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideTestCompileMojo.java @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2024-2025 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ +package dev.elide.maven.plugin; + +import org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.ResolutionScope; + +/** + * Elide Java test compiler Mojo. + * + * @author Lauri Heino + * @since 1.0.0 + */ +@Mojo( + name = "test-compile", + defaultPhase = LifecyclePhase.TEST_COMPILE, + threadSafe = true, + requiresDependencyResolution = ResolutionScope.TEST) +public class ElideTestCompileMojo extends ElideTestCompileMojoImpl { +} diff --git a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt new file mode 100644 index 0000000..e4f4306 --- /dev/null +++ b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt @@ -0,0 +1,14 @@ +package dev.elide.maven.plugin + +import org.apache.maven.plugin.compiler.AbstractCompilerMojo +import org.apache.maven.plugin.compiler.CompilerMojo + +/** @author Lauri Heino */ +open class ElideCompileMojoImpl : CompilerMojo() { + init { + AbstractCompilerMojo::class.java.getDeclaredField("compilerId").apply { + isAccessible = true + set(this@ElideCompileMojoImpl, "elide") + } + } +} diff --git a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideLifecycleParticipant.kt b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideLifecycleParticipant.kt new file mode 100644 index 0000000..20f1d0e --- /dev/null +++ b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideLifecycleParticipant.kt @@ -0,0 +1,10 @@ +package dev.elide.maven.plugin + +import dev.elide.maven.plugin.kotlin.ElideKotlinLifecycleParticipant + +/** @author Lauri Heino */ +open class ElideLifecycleParticipant : ElideKotlinLifecycleParticipant() { + init { + artifact = "elide-maven-plugin" + } +} diff --git a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt new file mode 100644 index 0000000..a26c924 --- /dev/null +++ b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt @@ -0,0 +1,15 @@ +package dev.elide.maven.plugin + +import org.apache.maven.plugin.compiler.AbstractCompilerMojo +import org.apache.maven.plugin.compiler.CompilerMojo +import org.apache.maven.plugin.compiler.TestCompilerMojo + +/** @author Lauri Heino */ +open class ElideTestCompileMojoImpl : TestCompilerMojo() { + init { + AbstractCompilerMojo::class.java.getDeclaredField("compilerId").apply { + isAccessible = true + set(this@ElideTestCompileMojoImpl, "elide") + } + } +} diff --git a/elide-plugin/src/main/resources/META-INF/plexus/components.xml b/elide-plugin/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 0000000..d1dd132 --- /dev/null +++ b/elide-plugin/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,206 @@ + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + jar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:test-compile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-jar-plugin:3.3.0:jar + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy + + + + + + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + ejb + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:test-compile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-ejb-plugin:3.2.1:ejb + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + + + + + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + war + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:test-compile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-war-plugin:2.2:war + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + + + + + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + rar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:test-compile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-rar-plugin:3.0.0:rar + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + + + + + + + + + org.apache.maven.AbstractMavenLifecycleParticipant + kotlin + dev.elide.maven.plugin.ElideLifecycleParticipant + + + \ No newline at end of file diff --git a/elide-plugin/src/test/kotlin/.gitkeep b/elide-plugin/src/test/kotlin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt index 184629e..12281cc 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt @@ -32,13 +32,12 @@ object ArgumentParser { compiler: String, arguments: A, project: MavenProject, - java: Boolean, ): Array { val list: MutableList = LinkedList() list.add(compiler) list.add("--") getAllFields(arguments::class.java).forEach { list.parseArgument(arguments, it) } - if (java && list.none { it == "-d" || it.startsWith("-d=") }) { + if (list.none { it == "-d" || it.startsWith("-d=") }) { list.add("-d") list.add(project.build.outputDirectory) } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojoImpl.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojoImpl.kt index ad5444c..30c921e 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojoImpl.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojoImpl.kt @@ -26,7 +26,7 @@ import java.io.File * @author Lauri Heino * @since 1.0.0 */ -internal open class ElideKotlinJVMCompileMojoImpl : K2JVMCompileMojo() { +open class ElideKotlinJVMCompileMojoImpl : K2JVMCompileMojo() { /** * Elide executable location. */ @@ -45,6 +45,5 @@ internal open class ElideKotlinJVMCompileMojoImpl : K2JVMCompileMojo() { project, executable, "kotlinc", - true, ) } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojoImpl.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojoImpl.kt index b1cc550..c30b93f 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojoImpl.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojoImpl.kt @@ -26,7 +26,7 @@ import java.io.File * @author Lauri Heino * @since 1.0.0 */ -internal open class ElideKotlinJVMTestCompileMojoImpl : KotlinTestCompileMojo() { +open class ElideKotlinJVMTestCompileMojoImpl : KotlinTestCompileMojo() { /** * Elide executable location. */ @@ -45,6 +45,5 @@ internal open class ElideKotlinJVMTestCompileMojoImpl : KotlinTestCompileMojo() project, executable, "kotlinc", - true, ) } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojoImpl.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojoImpl.kt index 90a2c1c..ad33478 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojoImpl.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojoImpl.kt @@ -26,7 +26,7 @@ import java.io.File * @author Lauri Heino * @since 1.0.0 */ -internal open class ElideKotlinKaptJVMCompileMojoImpl : KaptJVMCompilerMojo() { +open class ElideKotlinKaptJVMCompileMojoImpl : KaptJVMCompilerMojo() { /** * Elide executable location. */ @@ -45,6 +45,5 @@ internal open class ElideKotlinKaptJVMCompileMojoImpl : KaptJVMCompilerMojo() { project, executable, "kotlinc", - true, ) } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojoImpl.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojoImpl.kt index eea0176..fa17ba1 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojoImpl.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojoImpl.kt @@ -26,7 +26,7 @@ import java.io.File * @author Lauri Heino * @since 1.0.0 */ -internal open class ElideKotlinKaptJVMTestCompileMojoImpl : KaptTestJvmCompilerMojo() { +open class ElideKotlinKaptJVMTestCompileMojoImpl : KaptTestJvmCompilerMojo() { /** * Elide executable location. */ @@ -45,6 +45,5 @@ internal open class ElideKotlinKaptJVMTestCompileMojoImpl : KaptTestJvmCompilerM project, executable, "kotlinc", - true, ) } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt index eea0f08..d1a85d3 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt @@ -1,127 +1,62 @@ package dev.elide.maven.plugin.kotlin -import org.apache.maven.AbstractMavenLifecycleParticipant -import org.apache.maven.MavenExecutionException import org.apache.maven.execution.MavenSession -import org.apache.maven.model.Dependency import org.apache.maven.model.Plugin import org.apache.maven.project.MavenProject -import org.codehaus.plexus.logging.LogEnabled -import org.codehaus.plexus.logging.Logger -import org.codehaus.plexus.util.xml.Xpp3Dom -import java.io.File +import org.jetbrains.kotlin.maven.KotlinLifecycleParticipant -/** @author Lauri Heino */ -class ElideKotlinLifecycleParticipant : AbstractMavenLifecycleParticipant(), LogEnabled { - private var logger: Logger? = null +/** + * Map [KotlinLifecycleParticipant] to work as intended but use this plugin instead. + * + * @author Lauri Heino + * @since 1.0.0 + */ +open class ElideKotlinLifecycleParticipant : KotlinLifecycleParticipant() { + var artifact: String = ELIDE_KOTLIN_PLUGIN_ARTIFACT_ID - override fun enableLogging(logger: Logger?) { - this.logger = logger - } - - @Throws(MavenExecutionException::class) override fun afterProjectsRead(session: MavenSession) { + // using reflection here to avoid copying the entire parent class for (project in session.projects) { - val plugin = getKotlinMavenPlugin(project) - if (plugin != null && isExtensionsEnabled(plugin) && isSmartDefaultsEnabled(project)) { - configureSmartDefaults(project, plugin) + val plugin = getElideKotlinMavenPlugin(project) + if (plugin != null && + callPrivateFuncBoolean("isExtensionsEnabled", plugin.callArg()) && + callPrivateFuncBoolean("isSmartDefaultsEnabled", project.callArg())) { + callPrivateFunc("configureSmartDefaults", project.callArg(), plugin.callArg()) } } } - private fun isSmartDefaultsEnabled(project: MavenProject): Boolean { - // System property has priority - val sysProp = System.getProperty(SMART_DEFAULTS_ENABLED_PROPERTY) - if (sysProp != null) { - return sysProp.toBoolean() - } - - // Then check project properties - val projectProp = project.properties.getProperty(SMART_DEFAULTS_ENABLED_PROPERTY) - if (projectProp != null) { - return projectProp.toBoolean() - } - - // Enabled by default (when extensions=true) - return true - } - - private fun configureSmartDefaults(project: MavenProject, plugin: Plugin) { - logger?.info("Kotlin smart defaults are enabled for " + project.artifactId) - - addSourceRoots(project, plugin) - addStdlibDependency(project) - } - - private fun addSourceRoots(project: MavenProject, plugin: Plugin) { - if (hasUserDefinedSourceDirs(plugin)) { - return - } - - val baseDir = project.basedir - - val mainKotlinSource = File(baseDir, "src/main/kotlin") - if (mainKotlinSource.exists()) { - project.addCompileSourceRoot(mainKotlinSource.absolutePath) - } - - val testKotlinSource = File(baseDir, "src/test/kotlin") - if (testKotlinSource.exists()) { - project.addTestCompileSourceRoot(testKotlinSource.absolutePath) - } - } - - private fun hasUserDefinedSourceDirs(plugin: Plugin): Boolean { - val configuration = plugin.configuration - if (configuration is Xpp3Dom) { - val sourceDirs = configuration.getChild("sourceDirs") - return sourceDirs != null && sourceDirs.getChildCount() > 0 - } - return false - } - - private fun addStdlibDependency(project: MavenProject) { - if (hasStdlibDependency(project)) { - return - } - - val stdlib = Dependency() - stdlib.groupId = KOTLIN_GROUP_ID - stdlib.artifactId = KOTLIN_STDLIB_ARTIFACT_ID - stdlib.version = KOTLIN_VERSION - project.dependencies.add(stdlib) - - logger?.info("Added kotlin-stdlib dependency, version $KOTLIN_VERSION") - } - - private fun hasStdlibDependency(project: MavenProject): Boolean { - for (dependency in project.dependencies) { - if (KOTLIN_GROUP_ID == dependency.groupId && KOTLIN_STDLIB_ARTIFACT_ID == dependency.artifactId) { - return true - } - } - return false - } - - private fun getKotlinMavenPlugin(project: MavenProject): Plugin? { + fun getElideKotlinMavenPlugin(project: MavenProject): Plugin? { for (plugin in project.getBuildPlugins()) { - if (PLUGIN_GROUP_ID == plugin.groupId && PLUGIN_ARTIFACT_ID == plugin.artifactId) { + if (ELIDE_GROUP_ID == plugin.groupId && + artifact == plugin.artifactId + ) { return plugin } } return null } - private fun isExtensionsEnabled(plugin: Plugin): Boolean { - return plugin.extensions.toString().toBoolean() + inline fun T.callPrivateFuncBoolean(name: String, vararg args: Pair, out Any?>): Boolean = + T::class + .java + .getDeclaredMethod(name, *args.map { it.first }.toTypedArray()) + .apply { isAccessible = true } + .invoke(this, *args.map { it.second }.toTypedArray()) + .let { it as Boolean } + + inline fun T.callPrivateFunc(name: String, vararg args: Pair, out Any?>) { + T::class + .java + .getDeclaredMethod(name, *args.map { it.first }.toTypedArray()) + .apply { isAccessible = true } + .invoke(this, *args.map { it.second }.toTypedArray()) } + inline fun T.callArg() = Pair(T::class.java, this) + companion object { - private const val PLUGIN_GROUP_ID = "dev.elide" - private const val PLUGIN_ARTIFACT_ID = "elide-kotlin-maven-plugin" - private const val KOTLIN_GROUP_ID = "org.jetbrains.kotlin" - private const val KOTLIN_STDLIB_ARTIFACT_ID = "kotlin-stdlib" - private const val SMART_DEFAULTS_ENABLED_PROPERTY = "kotlin.smart.defaults.enabled" - private const val KOTLIN_VERSION = "2.3.21" + const val ELIDE_GROUP_ID = "dev.elide" + const val ELIDE_KOTLIN_PLUGIN_ARTIFACT_ID = "elide-kotlin-maven-plugin" } } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt index 3a95bf0..7399bcc 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt @@ -44,7 +44,6 @@ object ElideRunner { project: MavenProject, executable: String?, compiler: String, - java: Boolean, ): ExitCode { val freeArgs = arguments.freeArgs.toMutableList() for (sourceRoot in sourceRoots) { @@ -54,7 +53,7 @@ object ElideRunner { val cli = Commandline() cli.workingDirectory = project.basedir cli.executable = executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE - cli.addArguments(ArgumentParser.parseArguments(compiler, arguments, project, java)) + cli.addArguments(ArgumentParser.parseArguments(compiler, arguments, project)) val out = CommandLineUtils.StringStreamConsumer() var returnCode: Int try { diff --git a/pom.xml b/pom.xml index 9d3629a..4193d83 100644 --- a/pom.xml +++ b/pom.xml @@ -11,6 +11,7 @@ plexus-compilers + elide-plugin kotlin-plugin sample-java sample-kotlin diff --git a/sample-java/pom.xml b/sample-java/pom.xml index 6fda217..edff614 100644 --- a/sample-java/pom.xml +++ b/sample-java/pom.xml @@ -9,6 +9,13 @@ + dev.elide + elide-java-maven-plugin + 1.0.0 + true + + + org.apache.maven.plugins maven-compiler-plugin 3.15.0 @@ -19,7 +26,7 @@ - elide + 8 diff --git a/sample-mixed/pom.xml b/sample-mixed/pom.xml index b9b4b2b..e838f0b 100644 --- a/sample-mixed/pom.xml +++ b/sample-mixed/pom.xml @@ -25,25 +25,10 @@ dev.elide - elide-kotlin-maven-plugin + elide-maven-plugin 1.0.0 true - - org.apache.maven.plugins - maven-compiler-plugin - 3.15.0 - - - dev.elide - elide-plexus-compilers - 1.0.0 - - - - elide - - \ No newline at end of file From 2ccee2fec03453b8b63bc0bb6277fd8c16ba77a8 Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 16:45:57 +0300 Subject: [PATCH 05/19] chore: update usage, readme Signed-off-by: melodicore --- README.md | 51 ++++++++++++++---------------------------- sample-java/pom.xml | 8 +------ sample-mixed/README.md | 23 +++---------------- 3 files changed, 21 insertions(+), 61 deletions(-) diff --git a/README.md b/README.md index 5b2448c..ad6f699 100644 --- a/README.md +++ b/README.md @@ -11,50 +11,40 @@ This plugin can be consumed in a Maven project to use [Elide](https://elide.dev) - [x] Supports explicit path to `elide` - [x] Resolve `elide` via the `PATH` - [x] Swap out `kotlinc ...` for `elide kotlinc -- ...` -- [ ] Usability of Elide as a Maven toolchain +- [x] Usability of Elide as a Maven toolchain ## Usage -### Java +### Elide Plugin -Configuring Elide as your `javac` compiler: +The easiest way to start using Elide in your project is the `elide-maven-plugin`. Enable it and set `extensions` to +`true` and all of your Java and Kotlin sources will be compiled with Elide `javac` and `kotlinc`. **`pom.xml`** ```xml - maven-compiler-plugin - 3.15.0 - - - dev.elide - elide-plexus-compilers - 1.0.0 - - - - elide - + dev.elide + elide-maven-plugin + 1.0.0 + true ``` > [!TIP] -> See the [Java sample project](sample-java) 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. -### Kotlin +### Kotlin drop-in replacement -Configuring the Elide Kotlin plugin is done the exact same way as configuring the Kotlin Maven plugin, just replacing -the plugin coordinates: +If you already have a project that uses the `kotlin-maven-plugin`, you can use the `elide-kotlin-maven-plugin` as a +drop-in replacement. It supports all configuration you would expect from the Kotlin Maven plugin. **`pom.xml`** ```xml - src/main/kotlin - src/test/kotlin dev.elide @@ -69,24 +59,16 @@ the plugin coordinates: > [!TIP] > See the [Kotlin sample project](sample-kotlin) for a usage example. -### Mixed Java and Kotlin +### Java Compiler -By combining the Kotlin configuration and Java compiler replacement, mixed Java and Kotlin sources can be compiled with -Elide: +If you already have a complex project and just want the Elide Java compiler, you can set the `maven-compiler-plugin`'s +`compilerId` to `elide` to use Elide just as a Java compiler without using any plugins. **`pom.xml`** - ```xml - dev.elide - elide-kotlin-maven-plugin - 1.0.0 - true - - - org.apache.maven.plugins maven-compiler-plugin 3.15.0 @@ -105,4 +87,5 @@ Elide: ``` > [!TIP] -> See the [Mixed sources sample project](sample-mixed) for a usage example. \ No newline at end of file +> See the [Java sample project](sample-java) for a usage example. Elide also provides +> a [Gradle plugin](https://github.com/elide-dev/gradle). \ No newline at end of file diff --git a/sample-java/pom.xml b/sample-java/pom.xml index edff614..1ba651c 100644 --- a/sample-java/pom.xml +++ b/sample-java/pom.xml @@ -8,12 +8,6 @@ 1 - - dev.elide - elide-java-maven-plugin - 1.0.0 - true - org.apache.maven.plugins maven-compiler-plugin @@ -26,7 +20,7 @@ - 8 + elide diff --git a/sample-mixed/README.md b/sample-mixed/README.md index a1653ae..34a56ce 100644 --- a/sample-mixed/README.md +++ b/sample-mixed/README.md @@ -1,9 +1,7 @@ ## Elide Maven Kotlin Plugin: Mixed sources sample project -This project demonstrates use of Elide as a Java and Kotlin compiler within a Maven project. This is a drop-in -replacement for the Kotlin plugin, so configure your Kotlin project like normal, but use -`dev.elide:elide-kotlin-maven-plugin` instead of `org.jetbrains.kotlin:kotlin-maven-plugin`, add -`elide-plexus-compilers` as a dependency to the `maven-compiler-plugin` and configure `compilerId` to `elide`. +This project demonstrates use of Elide as a Java and Kotlin compiler within a Maven project. To configure it, simply add +the `dev.elide:elide-maven-plugin` and set `extensions` to `true`. **`pom.xml`** ```xml @@ -11,25 +9,10 @@ replacement for the Kotlin plugin, so configure your Kotlin project like normal, dev.elide - elide-kotlin-maven-plugin + elide-maven-plugin 1.0.0 true - - org.apache.maven.plugins - maven-compiler-plugin - 3.15.0 - - - dev.elide - elide-plexus-compilers - 1.0.0 - - - - elide - - ``` From 71443176764073c09c1b39afd0558948c5e6de81 Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 16:49:00 +0300 Subject: [PATCH 06/19] chore: rename elide-plexus-compilers to elide-java-compiler Signed-off-by: melodicore --- README.md | 2 +- elide-plugin/pom.xml | 2 +- {plexus-compilers => java-compiler}/pom.xml | 2 +- .../src/main/kotlin/dev/elide/maven/compiler/Constants.kt | 0 .../main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt | 0 .../src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt | 0 .../src/main/resources/META-INF/sisu/javax.inject.Named | 0 {plexus-compilers => java-compiler}/src/test/kotlin/.gitkeep | 0 kotlin-plugin/pom.xml | 2 +- pom.xml | 2 +- sample-java/README.md | 2 +- sample-java/pom.xml | 2 +- 12 files changed, 7 insertions(+), 7 deletions(-) rename {plexus-compilers => java-compiler}/pom.xml (98%) rename {plexus-compilers => java-compiler}/src/main/kotlin/dev/elide/maven/compiler/Constants.kt (100%) rename {plexus-compilers => java-compiler}/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt (100%) rename {plexus-compilers => java-compiler}/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt (100%) rename {plexus-compilers => java-compiler}/src/main/resources/META-INF/sisu/javax.inject.Named (100%) rename {plexus-compilers => java-compiler}/src/test/kotlin/.gitkeep (100%) diff --git a/README.md b/README.md index ad6f699..26071d0 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ If you already have a complex project and just want the Elide Java compiler, you dev.elide - elide-plexus-compilers + elide-java-compiler 1.0.0 diff --git a/elide-plugin/pom.xml b/elide-plugin/pom.xml index 37e1b98..62e23bd 100644 --- a/elide-plugin/pom.xml +++ b/elide-plugin/pom.xml @@ -250,7 +250,7 @@ dev.elide - elide-plexus-compilers + elide-java-compiler ${compilerVersion} diff --git a/plexus-compilers/pom.xml b/java-compiler/pom.xml similarity index 98% rename from plexus-compilers/pom.xml rename to java-compiler/pom.xml index 4d5bb6d..4a1fd36 100644 --- a/plexus-compilers/pom.xml +++ b/java-compiler/pom.xml @@ -5,7 +5,7 @@ 4.0.0 dev.elide - elide-plexus-compilers + elide-java-compiler 1.0.0 jar diff --git a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/Constants.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt similarity index 100% rename from plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/Constants.kt rename to java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt diff --git a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt similarity index 100% rename from plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt rename to java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt diff --git a/plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt similarity index 100% rename from plexus-compilers/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt rename to java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt diff --git a/plexus-compilers/src/main/resources/META-INF/sisu/javax.inject.Named b/java-compiler/src/main/resources/META-INF/sisu/javax.inject.Named similarity index 100% rename from plexus-compilers/src/main/resources/META-INF/sisu/javax.inject.Named rename to java-compiler/src/main/resources/META-INF/sisu/javax.inject.Named diff --git a/plexus-compilers/src/test/kotlin/.gitkeep b/java-compiler/src/test/kotlin/.gitkeep similarity index 100% rename from plexus-compilers/src/test/kotlin/.gitkeep rename to java-compiler/src/test/kotlin/.gitkeep diff --git a/kotlin-plugin/pom.xml b/kotlin-plugin/pom.xml index f0cb6cd..bd4eae5 100644 --- a/kotlin-plugin/pom.xml +++ b/kotlin-plugin/pom.xml @@ -261,7 +261,7 @@ dev.elide - elide-plexus-compilers + elide-java-compiler ${compilerVersion} diff --git a/pom.xml b/pom.xml index 4193d83..8296e65 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ pom - plexus-compilers + java-compiler elide-plugin kotlin-plugin sample-java diff --git a/sample-java/README.md b/sample-java/README.md index 15340a9..3399db9 100644 --- a/sample-java/README.md +++ b/sample-java/README.md @@ -13,7 +13,7 @@ This project demonstrates use of Elide as a replacement for `javac` within a Mav dev.elide - elide-plexus-compilers + elide-java-compiler 1.0.0 diff --git a/sample-java/pom.xml b/sample-java/pom.xml index 1ba651c..c570fc4 100644 --- a/sample-java/pom.xml +++ b/sample-java/pom.xml @@ -15,7 +15,7 @@ dev.elide - elide-plexus-compilers + elide-java-compiler 1.0.0 From 6902271c0ddd9c95c95267d591b7658987528532 Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 17:06:32 +0300 Subject: [PATCH 07/19] chore: cleanup, license headers, executable override Signed-off-by: melodicore --- .../elide/maven/plugin/ElideCompileMojo.java | 2 +- .../plugin/ElideKotlinJVMCompileMojo.java | 2 +- .../plugin/ElideKotlinJVMTestCompileMojo.java | 2 +- .../plugin/ElideKotlinKaptJVMCompileMojo.java | 2 +- .../ElideKotlinKaptJVMTestCompileMojo.java | 2 +- .../maven/plugin/ElideTestCompileMojo.java | 2 +- .../maven/plugin/ElideCompileMojoImpl.kt | 25 +++- .../maven/plugin/ElideLifecycleParticipant.kt | 19 ++- .../maven/plugin/ElideTestCompileMojoImpl.kt | 26 +++- .../dev/elide/maven/compiler/Constants.kt | 10 +- .../maven/compiler/ElideJavacCompiler.kt | 122 ++++++++++-------- .../dev/elide/maven/compiler/ElideLocator.kt | 6 +- .../kotlin/ElideKotlinJVMCompileMojo.java | 2 +- .../kotlin/ElideKotlinJVMTestCompileMojo.java | 2 +- .../kotlin/ElideKotlinKaptJVMCompileMojo.java | 2 +- .../ElideKotlinKaptJVMTestCompileMojo.java | 2 +- .../maven/plugin/kotlin/ArgumentParser.kt | 25 ++-- .../kotlin/ElideKotlinJVMCompileMojoImpl.kt | 16 +-- .../ElideKotlinJVMTestCompileMojoImpl.kt | 16 +-- .../ElideKotlinKaptJVMCompileMojoImpl.kt | 16 +-- .../ElideKotlinKaptJVMTestCompileMojoImpl.kt | 16 +-- .../kotlin/ElideKotlinLifecycleParticipant.kt | 35 +++-- .../elide/maven/plugin/kotlin/ElideRunner.kt | 9 +- 23 files changed, 207 insertions(+), 154 deletions(-) diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideCompileMojo.java index 6940f6f..7504fce 100644 --- a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideCompileMojo.java +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMCompileMojo.java index 84ff9eb..55c5403 100644 --- a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMCompileMojo.java +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMTestCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMTestCompileMojo.java index ec847ab..e1f1a1e 100644 --- a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMTestCompileMojo.java +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinJVMTestCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMCompileMojo.java index 49a8436..f22179e 100644 --- a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMCompileMojo.java +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMTestCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMTestCompileMojo.java index 9eb7ea0..3f69843 100644 --- a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMTestCompileMojo.java +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideKotlinKaptJVMTestCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideTestCompileMojo.java b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideTestCompileMojo.java index 06c92ea..7220775 100644 --- a/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideTestCompileMojo.java +++ b/elide-plugin/src/main/java/dev/elide/maven/plugin/ElideTestCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt index e4f4306..933b1bd 100644 --- a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt +++ b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt @@ -1,14 +1,37 @@ +/* + * Copyright (c) 2024-2026 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ package dev.elide.maven.plugin +import dev.elide.maven.compiler.ElideJavacCompiler import org.apache.maven.plugin.compiler.AbstractCompilerMojo import org.apache.maven.plugin.compiler.CompilerMojo +import org.apache.maven.plugins.annotations.Parameter -/** @author Lauri Heino */ +/** + * Elide Java compiler. + * + * @author Lauri Heino + * @since 1.0.0 + */ open class ElideCompileMojoImpl : CompilerMojo() { + /** Elide executable location. */ + @Parameter(name = "executable") var executable: String? = null + init { AbstractCompilerMojo::class.java.getDeclaredField("compilerId").apply { isAccessible = true set(this@ElideCompileMojoImpl, "elide") } + ElideJavacCompiler.executable = executable } } diff --git a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideLifecycleParticipant.kt b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideLifecycleParticipant.kt index 20f1d0e..4cb2498 100644 --- a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideLifecycleParticipant.kt +++ b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideLifecycleParticipant.kt @@ -1,8 +1,25 @@ +/* + * Copyright (c) 2024-2026 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ package dev.elide.maven.plugin import dev.elide.maven.plugin.kotlin.ElideKotlinLifecycleParticipant -/** @author Lauri Heino */ +/** + * Map [ElideKotlinLifecycleParticipant] to work as intended but use this plugin instead. + * + * @author Lauri Heino + * @since 1.0.0 + */ open class ElideLifecycleParticipant : ElideKotlinLifecycleParticipant() { init { artifact = "elide-maven-plugin" diff --git a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt index a26c924..865bf66 100644 --- a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt +++ b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt @@ -1,15 +1,37 @@ +/* + * Copyright (c) 2024-2026 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ package dev.elide.maven.plugin +import dev.elide.maven.compiler.ElideJavacCompiler import org.apache.maven.plugin.compiler.AbstractCompilerMojo -import org.apache.maven.plugin.compiler.CompilerMojo import org.apache.maven.plugin.compiler.TestCompilerMojo +import org.apache.maven.plugins.annotations.Parameter -/** @author Lauri Heino */ +/** + * Elide Java test compiler. + * + * @author Lauri Heino + * @since 1.0.0 + */ open class ElideTestCompileMojoImpl : TestCompilerMojo() { + /** Elide executable location. */ + @Parameter(name = "executable") var executable: String? = null + init { AbstractCompilerMojo::class.java.getDeclaredField("compilerId").apply { isAccessible = true set(this@ElideTestCompileMojoImpl, "elide") } + ElideJavacCompiler.executable = executable } } diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt index b88b294..e978302 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -12,10 +12,8 @@ */ package dev.elide.maven.compiler -/** - * Constant ID used by the Elide compiler shim. - */ -public const val ELIDE_COMPILER: String = "elide" +/** Constant ID used by the Elide compiler shim. */ +const val ELIDE_COMPILER: String = "elide" -public val ELIDE_EXECUTABLE: String = +val ELIDE_EXECUTABLE: String = if (System.getProperty("os.name").contains("windows", true)) "elide.exe" else "elide" diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt index 09b4100..04baf24 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -18,7 +18,7 @@ import org.codehaus.plexus.util.cli.CommandLineUtils import org.codehaus.plexus.util.cli.Commandline import java.io.File import java.io.IOException -import java.util.LinkedList +import java.util.* import javax.inject.Named import javax.inject.Singleton import kotlin.io.path.absolutePathString @@ -32,38 +32,35 @@ import kotlin.io.path.absolutePathString */ @Named(ELIDE_COMPILER) @Singleton -public open class ElideJavacCompiler() : AbstractCompiler( - CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE, - ".java", - ".class", - null -) { +open class ElideJavacCompiler : + AbstractCompiler(CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE, ".java", ".class", null) { override fun getCompilerId(): String = "elide" override fun performCompile(config: CompilerConfiguration): CompilerResult { val dest = File(config.outputLocation) - if(!dest.exists()) dest.mkdirs() + if (!dest.exists()) dest.mkdirs() val sources = getSourceFiles(config) ?: return CompilerResult() - if(sources.isEmpty()) return CompilerResult() + if (sources.isEmpty()) return CompilerResult() logCompiling(sources, config) val executable = getElideExecutable(config) - val args = buildList { - addAll(buildElideArgs(config, sources)) - config.maxmem?.ifEmpty { null }?.let { add("-J-Xmx$this") } - config.meminitial?.ifEmpty { null }?.let { add("-J-Xms$this") } + val args = + buildList { + addAll(buildElideArgs(config, sources)) + config.maxmem?.ifEmpty { null }?.let { add("-J-Xmx$this") } + config.meminitial?.ifEmpty { null }?.let { add("-J-Xms$this") } - config.customCompilerArgumentsAsMap.entries - .filter { it.value != null && it.key.startsWith("-J") } - .ifEmpty { null } - ?.forEach { add("${it.key}=${it.value}") } - } + config.customCompilerArgumentsAsMap.entries + .filter { it.value != null && it.key.startsWith("-J") } + .ifEmpty { null } + ?.forEach { add("${it.key}=${it.value}") } + } val cli = Commandline() cli.setWorkingDirectory(config.workingDirectory.absolutePath) cli.executable = executable config.customCompilerArgumentsAsMap.keys .filter { it != null && it.startsWith("-J") } - .apply { if(isNotEmpty()) cli.addArguments(toTypedArray()) } + .apply { if (isNotEmpty()) cli.addArguments(toTypedArray()) } cli.addArguments(args.toTypedArray()) val out = CommandLineUtils.StringStreamConsumer() @@ -72,16 +69,16 @@ public open class ElideJavacCompiler() : AbstractCompiler( try { returnCode = CommandLineUtils.executeCommandLine(cli, out, out) messages = parseOutput(returnCode, out.output.lines()) - } catch(e: CommandLineException) { + } catch (e: CommandLineException) { throw CompilerException("Error while executing Elide javac compiler.", e) - } catch(e: IOException) { + } catch (e: IOException) { throw CompilerException("Error while executing Elide javac compiler.", e) } return CompilerResult(returnCode == 0, messages) } private fun getElideExecutable(config: CompilerConfiguration): String = - config.executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE + executable ?: config.executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE override fun createCommandLine(config: CompilerConfiguration): Array { return buildElideArgs(config, getSourceFiles(config)).toTypedArray() @@ -94,18 +91,24 @@ public open class ElideJavacCompiler() : AbstractCompiler( val destinationDir = File(config.outputLocation) args.add("-d") args.add(destinationDir.absolutePath) - config.classpathEntries?.ifEmpty { null }?.let { - args.add("-classpath") - args.add(getPathString(it)) - } - config.modulepathEntries?.ifEmpty { null }?.let { - args.add("--module-path") - args.add(getPathString(it)) - } - config.sourceLocations?.ifEmpty { null }?.let { - args.add("-sourcepath") - args.add(getPathString(it)) - } + config.classpathEntries + ?.ifEmpty { null } + ?.let { + args.add("-classpath") + args.add(getPathString(it)) + } + config.modulepathEntries + ?.ifEmpty { null } + ?.let { + args.add("--module-path") + args.add(getPathString(it)) + } + config.sourceLocations + ?.ifEmpty { null } + ?.let { + args.add("-sourcepath") + args.add(getPathString(it)) + } args.addAll(listOf(*sources)) config.generatedSourcesDirectory.apply { @@ -118,14 +121,18 @@ public open class ElideJavacCompiler() : AbstractCompiler( args.add("-processor") args.add(indices.joinToString(",") { this[it] }) } - config.processorPathEntries?.ifEmpty { null }?.let { - args.add("-processorpath") - args.add(getPathString(it)) - } - config.processorModulePathEntries?.ifEmpty { null }?.let { - args.add("--processor-module-path") - args.add(getPathString(it)) - } + config.processorPathEntries + ?.ifEmpty { null } + ?.let { + args.add("-processorpath") + args.add(getPathString(it)) + } + config.processorModulePathEntries + ?.ifEmpty { null } + ?.let { + args.add("--processor-module-path") + args.add(getPathString(it)) + } if (config.isOptimize) args.add("-O") if (config.isDebug) { if (config.debugLevel?.isNotEmpty() == true) { @@ -174,14 +181,18 @@ public open class ElideJavacCompiler() : AbstractCompiler( args.add(config.sourceVersion) } } - config.sourceEncoding?.ifEmpty { null }?.let { - args.add("-encoding") - args.add(it) - } - config.moduleVersion?.ifEmpty { null }?.let { - args.add("--module-version") - args.add(it) - } + config.sourceEncoding + ?.ifEmpty { null } + ?.let { + args.add("-encoding") + args.add(it) + } + config.moduleVersion + ?.ifEmpty { null } + ?.let { + args.add("--module-version") + args.add(it) + } config.customCompilerArgumentsEntries?.forEach { (key, value) -> if (key.isEmpty() || key.startsWith("-J")) return@forEach args.add(key) @@ -192,8 +203,13 @@ public open class ElideJavacCompiler() : AbstractCompiler( @Throws(IOException::class) private fun parseOutput(exitCode: Int, input: List): List { - //very lazy for now - val kind = if(exitCode == 0) CompilerMessage.Kind.NOTE else CompilerMessage.Kind.ERROR + // very lazy for now + val kind = if (exitCode == 0) CompilerMessage.Kind.NOTE else CompilerMessage.Kind.ERROR return input.map { CompilerMessage(it, kind) } } + + companion object { + // allow overriding executable in elide-maven-plugin + var executable: String? = null + } } diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt index 0a78d76..455f148 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -22,7 +22,9 @@ import java.nio.file.Paths * @since 1.0.0 */ object ElideLocator { - // Checks if a path is a valid binary. + /** + * Checks if a path is a valid binary. + */ private fun isValidElideBinary(path: Path): Boolean { return path.toFile().exists() && path.toFile().isFile && path.toFile().canExecute() } diff --git a/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojo.java b/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojo.java index df28ea9..47c5cab 100644 --- a/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojo.java +++ b/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojo.java b/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojo.java index 074ca72..ab05f38 100644 --- a/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojo.java +++ b/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojo.java b/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojo.java index 0b618e1..67d7a11 100644 --- a/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojo.java +++ b/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojo.java b/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojo.java index 046d513..688a7c1 100644 --- a/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojo.java +++ b/kotlin-plugin/src/main/java/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt index 12281cc..967c232 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -12,11 +12,11 @@ */ package dev.elide.maven.plugin.kotlin +import java.lang.reflect.Field +import java.util.* import org.apache.maven.project.MavenProject import org.jetbrains.kotlin.cli.common.arguments.Argument import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments -import java.lang.reflect.Field -import java.util.* /** * Parser for Kotlin compiler arguments. @@ -25,9 +25,7 @@ import java.util.* * @since 1.0.0 */ object ArgumentParser { - /** - * Parses [A] into a list of Elide Kotlin compiler command line arguments. - */ + /** Parses [A] into a list of Elide Kotlin compiler command line arguments. */ fun parseArguments( compiler: String, arguments: A, @@ -49,18 +47,19 @@ object ArgumentParser { private fun getAllFields(type: Class): List { var type: Class = type val fields: MutableList = LinkedList() - fields.addAll(type.declaredFields.filter { it.trySetAccessible() && it.isAnnotationPresent(Argument::class.java) }) - while(type != CommonCompilerArguments::class.java) { + fields.addAll( + type.declaredFields.filter { it.trySetAccessible() && it.isAnnotationPresent(Argument::class.java) } + ) + while (type != CommonCompilerArguments::class.java) { type = type.superclass as Class - fields.addAll(type.declaredFields.filter { it.trySetAccessible() && it.isAnnotationPresent(Argument::class.java) }) + fields.addAll( + type.declaredFields.filter { it.trySetAccessible() && it.isAnnotationPresent(Argument::class.java) } + ) } return fields } - private fun MutableList.parseArgument( - arguments: A, - field: Field, - ) { + private fun MutableList.parseArgument(arguments: A, field: Field) { val argument = field.getAnnotation(Argument::class.java) ?: return val element: Any = field.get(arguments) ?: return when (element) { diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojoImpl.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojoImpl.kt index 30c921e..44fabd2 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojoImpl.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMCompileMojoImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -27,9 +27,7 @@ import java.io.File * @since 1.0.0 */ open class ElideKotlinJVMCompileMojoImpl : K2JVMCompileMojo() { - /** - * Elide executable location. - */ + /** Elide executable location. */ @Parameter(name = "executable") var executable: String? = null override fun execCompiler( @@ -37,13 +35,5 @@ open class ElideKotlinJVMCompileMojoImpl : K2JVMCompileMojo() { messageCollector: MessageCollector, arguments: K2JVMCompilerArguments, sourceRoots: List, - ): ExitCode = - ElideRunner.runCompiler( - messageCollector, - arguments, - sourceRoots, - project, - executable, - "kotlinc", - ) + ): ExitCode = ElideRunner.runCompiler(messageCollector, arguments, sourceRoots, project, executable, "kotlinc") } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojoImpl.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojoImpl.kt index c30b93f..3ca79be 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojoImpl.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinJVMTestCompileMojoImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -27,9 +27,7 @@ import java.io.File * @since 1.0.0 */ open class ElideKotlinJVMTestCompileMojoImpl : KotlinTestCompileMojo() { - /** - * Elide executable location. - */ + /** Elide executable location. */ @Parameter(name = "executable") var executable: String? = null override fun execCompiler( @@ -37,13 +35,5 @@ open class ElideKotlinJVMTestCompileMojoImpl : KotlinTestCompileMojo() { messageCollector: MessageCollector, arguments: K2JVMCompilerArguments, sourceRoots: List, - ): ExitCode = - ElideRunner.runCompiler( - messageCollector, - arguments, - sourceRoots, - project, - executable, - "kotlinc", - ) + ): ExitCode = ElideRunner.runCompiler(messageCollector, arguments, sourceRoots, project, executable, "kotlinc") } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojoImpl.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojoImpl.kt index ad33478..0a3ec3b 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojoImpl.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMCompileMojoImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -27,9 +27,7 @@ import java.io.File * @since 1.0.0 */ open class ElideKotlinKaptJVMCompileMojoImpl : KaptJVMCompilerMojo() { - /** - * Elide executable location. - */ + /** Elide executable location. */ @Parameter(name = "executable") var executable: String? = null override fun execCompiler( @@ -37,13 +35,5 @@ open class ElideKotlinKaptJVMCompileMojoImpl : KaptJVMCompilerMojo() { messageCollector: MessageCollector, arguments: K2JVMCompilerArguments, sourceRoots: List, - ): ExitCode = - ElideRunner.runCompiler( - messageCollector, - arguments, - sourceRoots, - project, - executable, - "kotlinc", - ) + ): ExitCode = ElideRunner.runCompiler(messageCollector, arguments, sourceRoots, project, executable, "kotlinc") } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojoImpl.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojoImpl.kt index fa17ba1..fdd3698 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojoImpl.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinKaptJVMTestCompileMojoImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -27,9 +27,7 @@ import java.io.File * @since 1.0.0 */ open class ElideKotlinKaptJVMTestCompileMojoImpl : KaptTestJvmCompilerMojo() { - /** - * Elide executable location. - */ + /** Elide executable location. */ @Parameter(name = "executable") var executable: String? = null override fun execCompiler( @@ -37,13 +35,5 @@ open class ElideKotlinKaptJVMTestCompileMojoImpl : KaptTestJvmCompilerMojo() { messageCollector: MessageCollector, arguments: K2JVMCompilerArguments, sourceRoots: List, - ): ExitCode = - ElideRunner.runCompiler( - messageCollector, - arguments, - sourceRoots, - project, - executable, - "kotlinc", - ) + ): ExitCode = ElideRunner.runCompiler(messageCollector, arguments, sourceRoots, project, executable, "kotlinc") } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt index d1a85d3..e8691f0 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt @@ -1,3 +1,15 @@ +/* + * Copyright (c) 2024-2026 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ package dev.elide.maven.plugin.kotlin import org.apache.maven.execution.MavenSession @@ -18,26 +30,33 @@ open class ElideKotlinLifecycleParticipant : KotlinLifecycleParticipant() { // using reflection here to avoid copying the entire parent class for (project in session.projects) { val plugin = getElideKotlinMavenPlugin(project) - if (plugin != null && - callPrivateFuncBoolean("isExtensionsEnabled", plugin.callArg()) && - callPrivateFuncBoolean("isSmartDefaultsEnabled", project.callArg())) { - callPrivateFunc("configureSmartDefaults", project.callArg(), plugin.callArg()) + if ( + plugin != null && + callPrivateFuncBoolean("isExtensionsEnabled", plugin.callArg()) && + callPrivateFuncBoolean("isSmartDefaultsEnabled", project.callArg()) + ) { + callPrivateFunc( + "configureSmartDefaults", + project.callArg(), + plugin.callArg(), + ) } } } fun getElideKotlinMavenPlugin(project: MavenProject): Plugin? { for (plugin in project.getBuildPlugins()) { - if (ELIDE_GROUP_ID == plugin.groupId && - artifact == plugin.artifactId - ) { + if (ELIDE_GROUP_ID == plugin.groupId && artifact == plugin.artifactId) { return plugin } } return null } - inline fun T.callPrivateFuncBoolean(name: String, vararg args: Pair, out Any?>): Boolean = + inline fun T.callPrivateFuncBoolean( + name: String, + vararg args: Pair, out Any?>, + ): Boolean = T::class .java .getDeclaredMethod(name, *args.map { it.first }.toTypedArray()) diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt index 7399bcc..bc510a9 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideRunner.kt @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024-2025 Elide Technologies, Inc. + * Copyright (c) 2024-2026 Elide Technologies, Inc. * * Licensed under the MIT license (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at @@ -34,9 +34,7 @@ import kotlin.io.path.absolutePathString * @since 1.0.0 */ object ElideRunner { - /** - * Executes the Elide Kotlin compiler according to [arguments]. - */ + /** Executes the Elide Kotlin compiler according to [arguments]. */ fun runCompiler( messageCollector: MessageCollector, arguments: A, @@ -60,8 +58,7 @@ object ElideRunner { returnCode = CommandLineUtils.executeCommandLine(cli, out, out) out.output.lines().forEach { messageCollector.report( - if (returnCode == 0) CompilerMessageSeverity.INFO - else CompilerMessageSeverity.ERROR, + if (returnCode == 0) CompilerMessageSeverity.INFO else CompilerMessageSeverity.ERROR, it, ) } From e01c94c4e02390024fc2d9fa66fe8d6c6baa6eed Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 17:09:29 +0300 Subject: [PATCH 08/19] chore: update ci Signed-off-by: melodicore --- .github/workflows/job.build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/job.build.yml b/.github/workflows/job.build.yml index 36ce125..0842a3f 100644 --- a/.github/workflows/job.build.yml +++ b/.github/workflows/job.build.yml @@ -46,9 +46,11 @@ jobs: with: channel: nightly - name: "Build: Java Compiler" - run: ./mvnw clean install -pl plexus-compilers + run: ./mvnw clean install -pl java-compiler - name: "Build: Kotlin Plugin" run: ./mvnw clean install -pl kotlin-plugin + - name: "Build: Elide Plugin" + run: ./mvnw clean install -pl elide-plugin - name: "Test: Java Compiler" run: ./mvnw clean package -pl sample-java - name: "Test: Kotlin Plugin" From 583e5d64e7abcf00c752360b4173b35151b5b3b1 Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 17:25:13 +0300 Subject: [PATCH 09/19] chore: unnecessary groupId Signed-off-by: melodicore --- sample-java/pom.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/sample-java/pom.xml b/sample-java/pom.xml index c570fc4..79f02ec 100644 --- a/sample-java/pom.xml +++ b/sample-java/pom.xml @@ -9,7 +9,6 @@ - org.apache.maven.plugins maven-compiler-plugin 3.15.0 From ecc55f74b0002c09f8fba0a7dc23313c7c4ca260 Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 17:47:18 +0300 Subject: [PATCH 10/19] chore: cleanup x2 Signed-off-by: melodicore --- elide-plugin/pom.xml | 51 ++++++++----------------------------------- kotlin-plugin/pom.xml | 35 +---------------------------- sample-java/README.md | 2 +- 3 files changed, 11 insertions(+), 77 deletions(-) diff --git a/elide-plugin/pom.xml b/elide-plugin/pom.xml index 62e23bd..41cb678 100644 --- a/elide-plugin/pom.xml +++ b/elide-plugin/pom.xml @@ -41,6 +41,7 @@ 11 1.0.0 + 1.0.0 2.3.21 1 2.16.2 @@ -93,9 +94,9 @@ - org.jetbrains.kotlin - kotlin-maven-plugin - ${kotlinVersion} + dev.elide + elide-kotlin-maven-plugin + ${elideKotlinVersion} compile @@ -130,7 +131,7 @@ dev.elide - elide-plexus-compilers + elide-java-compiler ${compilerVersion} @@ -176,11 +177,11 @@ - + - org.codehaus.plexus - plexus-utils - ${plexusUtilsVersion} + commons-io + commons-io + 2.22.0 @@ -226,49 +227,15 @@ maven-plugin-annotations ${mavenToolsVersion} - - org.jetbrains.kotlin - kotlin-build-tools-api - ${kotlinVersion} - compile - - - org.jetbrains.kotlin - kotlin-build-tools-impl - ${kotlinVersion} - runtime - - - org.jetbrains.kotlin - kotlin-compiler-embeddable - ${kotlinVersion} - - - org.jetbrains.kotlin - kotlin-scripting-compiler-embeddable - ${kotlinVersion} - dev.elide elide-java-compiler ${compilerVersion} - - javax.inject - javax.inject - ${injectVersion} - - - org.codehaus.plexus - plexus-xml - 4.1.1 - provided - dev.elide elide-kotlin-maven-plugin 1.0.0 - compile \ No newline at end of file diff --git a/kotlin-plugin/pom.xml b/kotlin-plugin/pom.xml index bd4eae5..d563968 100644 --- a/kotlin-plugin/pom.xml +++ b/kotlin-plugin/pom.xml @@ -130,7 +130,7 @@ dev.elide - elide-plexus-compilers + elide-java-compiler ${compilerVersion} @@ -176,12 +176,6 @@ - - - org.codehaus.plexus - plexus-utils - ${plexusUtilsVersion} - commons-io @@ -237,37 +231,10 @@ maven-plugin-annotations ${mavenToolsVersion} - - org.jetbrains.kotlin - kotlin-build-tools-api - ${kotlinVersion} - compile - - - org.jetbrains.kotlin - kotlin-build-tools-impl - ${kotlinVersion} - runtime - - - org.jetbrains.kotlin - kotlin-compiler-embeddable - ${kotlinVersion} - - - org.jetbrains.kotlin - kotlin-scripting-compiler-embeddable - ${kotlinVersion} - dev.elide elide-java-compiler ${compilerVersion} - - javax.inject - javax.inject - ${injectVersion} - \ No newline at end of file diff --git a/sample-java/README.md b/sample-java/README.md index 3399db9..52be430 100644 --- a/sample-java/README.md +++ b/sample-java/README.md @@ -1,7 +1,7 @@ ## Elide Maven Java Compiler: Sample project This project demonstrates use of Elide as a replacement for `javac` within a Maven project. Explicitly add the -`maven-compiler-plugin`, add `elide-plexus-compilers` as a dependency, and configure `compilerId` to `elide`. +`maven-compiler-plugin`, add `elide-java-compiler` as a dependency, and configure `compilerId` to `elide`. **`pom.xml`** ```xml From 4cc786fba3a21956a0709a2cfe1ac4871b35e0d6 Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 17:53:09 +0300 Subject: [PATCH 11/19] fix: fix ci Signed-off-by: melodicore --- elide-plugin/pom.xml | 7 +++---- pom.xml | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/elide-plugin/pom.xml b/elide-plugin/pom.xml index 41cb678..a155da8 100644 --- a/elide-plugin/pom.xml +++ b/elide-plugin/pom.xml @@ -41,7 +41,6 @@ 11 1.0.0 - 1.0.0 2.3.21 1 2.16.2 @@ -94,9 +93,9 @@ - dev.elide - elide-kotlin-maven-plugin - ${elideKotlinVersion} + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlinVersion} compile diff --git a/pom.xml b/pom.xml index 8296e65..ba41f8a 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,8 @@ java-compiler - elide-plugin kotlin-plugin + elide-plugin sample-java sample-kotlin sample-mixed From 641b51e4dc88b5e56e435b827504ea570b045381 Mon Sep 17 00:00:00 2001 From: melodicore Date: Tue, 5 May 2026 17:57:04 +0300 Subject: [PATCH 12/19] fix: fix ci x2 Signed-off-by: melodicore --- .github/workflows/job.build.yml | 6 +++--- pom.xml | 3 --- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/job.build.yml b/.github/workflows/job.build.yml index 0842a3f..d5fd5a4 100644 --- a/.github/workflows/job.build.yml +++ b/.github/workflows/job.build.yml @@ -52,8 +52,8 @@ jobs: - name: "Build: Elide Plugin" run: ./mvnw clean install -pl elide-plugin - name: "Test: Java Compiler" - run: ./mvnw clean package -pl sample-java + run: ./mvnw clean package -f sample-java - name: "Test: Kotlin Plugin" - run: ./mvnw clean package -pl sample-kotlin + run: ./mvnw clean package -f sample-kotlin - name: "Test: Mixed source" - run: ./mvnw clean package -pl sample-mixed + run: ./mvnw clean package -f sample-mixed diff --git a/pom.xml b/pom.xml index ba41f8a..bf0e055 100644 --- a/pom.xml +++ b/pom.xml @@ -13,8 +13,5 @@ java-compiler kotlin-plugin elide-plugin - sample-java - sample-kotlin - sample-mixed \ No newline at end of file From e8a42bda276fb7f35c2773b6652c152723506876 Mon Sep 17 00:00:00 2001 From: melodicore Date: Wed, 6 May 2026 11:11:11 +0300 Subject: [PATCH 13/19] fix: address review comments Signed-off-by: melodicore --- .../dev/elide/maven/plugin/ElideCompileMojoImpl.kt | 11 ++++++++--- .../elide/maven/plugin/ElideTestCompileMojoImpl.kt | 11 ++++++++--- .../dev/elide/maven/compiler/ElideJavacCompiler.kt | 7 +------ .../kotlin/dev/elide/maven/compiler/ElideLocator.kt | 3 ++- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt index 933b1bd..b3d1534 100644 --- a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt +++ b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideCompileMojoImpl.kt @@ -12,7 +12,6 @@ */ package dev.elide.maven.plugin -import dev.elide.maven.compiler.ElideJavacCompiler import org.apache.maven.plugin.compiler.AbstractCompilerMojo import org.apache.maven.plugin.compiler.CompilerMojo import org.apache.maven.plugins.annotations.Parameter @@ -27,11 +26,17 @@ open class ElideCompileMojoImpl : CompilerMojo() { /** Elide executable location. */ @Parameter(name = "executable") var executable: String? = null - init { + override fun execute() { AbstractCompilerMojo::class.java.getDeclaredField("compilerId").apply { isAccessible = true set(this@ElideCompileMojoImpl, "elide") } - ElideJavacCompiler.executable = executable + executable?.let { + AbstractCompilerMojo::class.java.getDeclaredField("executable").apply { + isAccessible = true + set(this@ElideCompileMojoImpl, it) + } + } + super.execute() } } diff --git a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt index 865bf66..32e9474 100644 --- a/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt +++ b/elide-plugin/src/main/kotlin/dev/elide/maven/plugin/ElideTestCompileMojoImpl.kt @@ -12,7 +12,6 @@ */ package dev.elide.maven.plugin -import dev.elide.maven.compiler.ElideJavacCompiler import org.apache.maven.plugin.compiler.AbstractCompilerMojo import org.apache.maven.plugin.compiler.TestCompilerMojo import org.apache.maven.plugins.annotations.Parameter @@ -27,11 +26,17 @@ open class ElideTestCompileMojoImpl : TestCompilerMojo() { /** Elide executable location. */ @Parameter(name = "executable") var executable: String? = null - init { + override fun execute() { AbstractCompilerMojo::class.java.getDeclaredField("compilerId").apply { isAccessible = true set(this@ElideTestCompileMojoImpl, "elide") } - ElideJavacCompiler.executable = executable + executable?.let { + AbstractCompilerMojo::class.java.getDeclaredField("executable").apply { + isAccessible = true + set(this@ElideTestCompileMojoImpl, it) + } + } + super.execute() } } diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt index 04baf24..53843ed 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt @@ -78,7 +78,7 @@ open class ElideJavacCompiler : } private fun getElideExecutable(config: CompilerConfiguration): String = - executable ?: config.executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE + config.executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE override fun createCommandLine(config: CompilerConfiguration): Array { return buildElideArgs(config, getSourceFiles(config)).toTypedArray() @@ -207,9 +207,4 @@ open class ElideJavacCompiler : val kind = if (exitCode == 0) CompilerMessage.Kind.NOTE else CompilerMessage.Kind.ERROR return input.map { CompilerMessage(it, kind) } } - - companion object { - // allow overriding executable in elide-maven-plugin - var executable: String? = null - } } diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt index 455f148..8be9607 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt @@ -12,6 +12,7 @@ */ package dev.elide.maven.compiler +import java.io.File.pathSeparatorChar import java.nio.file.Path import java.nio.file.Paths @@ -36,7 +37,7 @@ object ElideLocator { */ fun locate(): Path? { val path = System.getenv("PATH") ?: "" - for (pathCandidate in path.split(':')) { + for (pathCandidate in path.split(pathSeparatorChar)) { val candidate = Paths.get(pathCandidate, ELIDE_EXECUTABLE) if (isValidElideBinary(candidate)) { return candidate From e02821f4cff8188af7a71596a545f9fa1d3b3325 Mon Sep 17 00:00:00 2001 From: melodicore Date: Wed, 6 May 2026 11:12:39 +0300 Subject: [PATCH 14/19] chore: run samples when testing, add simple makefile Signed-off-by: melodicore --- .github/workflows/job.build.yml | 6 +++--- Makefile | 26 ++++++++++++++++++++++++++ sample-java/pom.xml | 15 +++++++++++++++ sample-kotlin/pom.xml | 15 +++++++++++++++ sample-mixed/pom.xml | 15 +++++++++++++++ 5 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 Makefile diff --git a/.github/workflows/job.build.yml b/.github/workflows/job.build.yml index d5fd5a4..e2716b6 100644 --- a/.github/workflows/job.build.yml +++ b/.github/workflows/job.build.yml @@ -52,8 +52,8 @@ jobs: - name: "Build: Elide Plugin" run: ./mvnw clean install -pl elide-plugin - name: "Test: Java Compiler" - run: ./mvnw clean package -f sample-java + run: ./mvnw clean package exec:java -f sample-java - name: "Test: Kotlin Plugin" - run: ./mvnw clean package -f sample-kotlin + run: ./mvnw clean package exec:java -f sample-kotlin - name: "Test: Mixed source" - run: ./mvnw clean package -f sample-mixed + run: ./mvnw clean package exec:java -f sample-mixed diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c323cee --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +all: clean install samples + +clean: + ./mvnw clean + +install: java kotlin plugin + +java: + ./mvnw install -pl java-compiler + +kotlin: + ./mvnw install -pl kotlin-plugin + +plugin: + ./mvnw install -pl elide-plugin + +samples: sample-java sample-kotlin sample-plugin + +sample-java: + ./mvnw clean package exec:java -f sample-java + +sample-kotlin: + ./mvnw clean package exec:java -f sample-kotlin + +sample-plugin: + ./mvnw clean package exec:java -f sample-mixed \ No newline at end of file diff --git a/sample-java/pom.xml b/sample-java/pom.xml index 79f02ec..808b73d 100644 --- a/sample-java/pom.xml +++ b/sample-java/pom.xml @@ -22,6 +22,21 @@ elide + + org.codehaus.mojo + exec-maven-plugin + 3.6.3 + + + + java + + + + + com.sample.Hello + + diff --git a/sample-kotlin/pom.xml b/sample-kotlin/pom.xml index ac5d1db..16f033e 100644 --- a/sample-kotlin/pom.xml +++ b/sample-kotlin/pom.xml @@ -24,6 +24,21 @@ 1.0.0 true + + org.codehaus.mojo + exec-maven-plugin + 3.6.3 + + + + java + + + + + com.sample.HelloKt + + \ No newline at end of file diff --git a/sample-mixed/pom.xml b/sample-mixed/pom.xml index e838f0b..bbde5eb 100644 --- a/sample-mixed/pom.xml +++ b/sample-mixed/pom.xml @@ -29,6 +29,21 @@ 1.0.0 true + + org.codehaus.mojo + exec-maven-plugin + 3.6.3 + + + + java + + + + + com.sample.Hello + + \ No newline at end of file From 005fd89b8c0f9f49d66a6d2a632311bf2dcffcfb Mon Sep 17 00:00:00 2001 From: melodicore Date: Mon, 11 May 2026 12:23:58 +0300 Subject: [PATCH 15/19] feat: piggyback off of JavacCompiler for better output handling Signed-off-by: melodicore --- java-compiler/pom.xml | 5 + .../maven/compiler/ElideJavacCompiler.kt | 266 ++++++++---------- .../kotlin/ElideKotlinLifecycleParticipant.kt | 13 +- 3 files changed, 129 insertions(+), 155 deletions(-) diff --git a/java-compiler/pom.xml b/java-compiler/pom.xml index 4a1fd36..85fb791 100644 --- a/java-compiler/pom.xml +++ b/java-compiler/pom.xml @@ -121,5 +121,10 @@ plexus-compiler-api ${plexusVersion} + + org.codehaus.plexus + plexus-compiler-javac + ${plexusVersion} + \ No newline at end of file diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt index 53843ed..527c02a 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt @@ -12,13 +12,19 @@ */ package dev.elide.maven.compiler -import org.codehaus.plexus.compiler.* +import org.codehaus.plexus.compiler.CompilerConfiguration +import org.codehaus.plexus.compiler.CompilerException +import org.codehaus.plexus.compiler.CompilerMessage +import org.codehaus.plexus.compiler.CompilerResult +import org.codehaus.plexus.compiler.javac.JavacCompiler +import org.codehaus.plexus.util.StringUtils import org.codehaus.plexus.util.cli.CommandLineException import org.codehaus.plexus.util.cli.CommandLineUtils import org.codehaus.plexus.util.cli.Commandline +import java.io.BufferedReader import java.io.File import java.io.IOException -import java.util.* +import java.io.StringReader import javax.inject.Named import javax.inject.Singleton import kotlin.io.path.absolutePathString @@ -32,179 +38,139 @@ import kotlin.io.path.absolutePathString */ @Named(ELIDE_COMPILER) @Singleton -open class ElideJavacCompiler : - AbstractCompiler(CompilerOutputStyle.ONE_OUTPUT_FILE_PER_INPUT_FILE, ".java", ".class", null) { +open class ElideJavacCompiler : JavacCompiler() { override fun getCompilerId(): String = "elide" override fun performCompile(config: CompilerConfiguration): CompilerResult { - val dest = File(config.outputLocation) - if (!dest.exists()) dest.mkdirs() - val sources = getSourceFiles(config) ?: return CompilerResult() - if (sources.isEmpty()) return CompilerResult() - logCompiling(sources, config) + config.isFork = true + + val destinationDir = File(config.outputLocation) + if (!destinationDir.exists()) destinationDir.mkdirs() + + val sourceFiles = getSourceFiles(config) + if (sourceFiles == null || sourceFiles.size == 0) return CompilerResult() + + logCompiling(sourceFiles, config) + val executable = getElideExecutable(config) - val args = - buildList { - addAll(buildElideArgs(config, sources)) - config.maxmem?.ifEmpty { null }?.let { add("-J-Xmx$this") } - config.meminitial?.ifEmpty { null }?.let { add("-J-Xms$this") } - - config.customCompilerArgumentsAsMap.entries - .filter { it.value != null && it.key.startsWith("-J") } - .ifEmpty { null } - ?.forEach { add("${it.key}=${it.value}") } - } + val javacVersion = getElideJavacVersion(executable) + val args = buildCompilerArguments(config, sourceFiles, javacVersion) + return compileOutOfProcess(config, executable, args) + } + + override fun compileOutOfProcess( + config: CompilerConfiguration, + executable: String, + args: Array, + ): CompilerResult { val cli = Commandline() + cli.setWorkingDirectory(config.workingDirectory.absolutePath) - cli.executable = executable - config.customCompilerArgumentsAsMap.keys - .filter { it != null && it.startsWith("-J") } - .apply { if (isNotEmpty()) cli.addArguments(toTypedArray()) } + cli.setExecutable(executable) + + try { + val argumentsFile = + JavacCompiler::class + .java + .getDeclaredMethod("createFileWithArguments", String::class.java.arrayType(), String::class.java) + .run { + isAccessible = true + invoke(this@ElideJavacCompiler, args, config.buildDirectory.absolutePath) as File + } + cli.addArguments( + arrayOf("javac", "--", "@" + argumentsFile.getCanonicalPath().replace(File.separatorChar, '/')) + ) + + if (!StringUtils.isEmpty(config.maxmem)) cli.addArguments(arrayOf("-J-Xmx${config.maxmem}")) + if (!StringUtils.isEmpty(config.meminitial)) cli.addArguments(arrayOf("-J-Xms${config.meminitial}")) + + for (key in config.getCustomCompilerArgumentsAsMap().keys) { + if (StringUtils.isNotEmpty(key) && key.startsWith("-J")) cli.addArguments(arrayOf(key)) + } + } catch (e: IOException) { + throw CompilerException("Error creating file with javac arguments", e) + } - cli.addArguments(args.toTypedArray()) val out = CommandLineUtils.StringStreamConsumer() - var returnCode: Int + val returnCode: Int val messages: List + try { returnCode = CommandLineUtils.executeCommandLine(cli, out, out) - messages = parseOutput(returnCode, out.output.lines()) + + if (log.isDebugEnabled) log.debug("Compiler output:{}{}", EOL, out.output) + + messages = + JavacCompiler::class + .java + .getDeclaredMethod("parseModernStream", Int::class.java, BufferedReader::class.java) + .run { + isAccessible = true + @Suppress("UNCHECKED_CAST") + invoke(null, returnCode, BufferedReader(StringReader(out.output))) as MutableList + } + val last = out.output.lines().reversed().let { + for (line in it) { + if (line.isNotBlank()) return@let line + } + "" + } + if (last.isNotBlank()) { + if (last.contains("✅")) messages.add(CompilerMessage(last, CompilerMessage.Kind.NOTE)) + else if (last.contains("❌")) messages.add(CompilerMessage(last, CompilerMessage.Kind.ERROR)) + } } catch (e: CommandLineException) { - throw CompilerException("Error while executing Elide javac compiler.", e) + throw CompilerException("Error while executing the Elide javac compiler.", e) } catch (e: IOException) { - throw CompilerException("Error while executing Elide javac compiler.", e) + throw CompilerException("Error while executing the Elide javac compiler.", e) } - return CompilerResult(returnCode == 0, messages) + + val success = returnCode == 0 + return CompilerResult(success, messages) } private fun getElideExecutable(config: CompilerConfiguration): String = config.executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE - override fun createCommandLine(config: CompilerConfiguration): Array { - return buildElideArgs(config, getSourceFiles(config)).toTypedArray() - } - - private fun buildElideArgs(config: CompilerConfiguration, sources: Array): MutableList { - val args: MutableList = LinkedList() - args.add("javac") - args.add("--") - val destinationDir = File(config.outputLocation) - args.add("-d") - args.add(destinationDir.absolutePath) - config.classpathEntries - ?.ifEmpty { null } - ?.let { - args.add("-classpath") - args.add(getPathString(it)) - } - config.modulepathEntries - ?.ifEmpty { null } - ?.let { - args.add("--module-path") - args.add(getPathString(it)) - } - config.sourceLocations - ?.ifEmpty { null } - ?.let { - args.add("-sourcepath") - args.add(getPathString(it)) - } - args.addAll(listOf(*sources)) - - config.generatedSourcesDirectory.apply { - mkdirs() - args.add("-s") - args.add(absolutePath) - } - config.proc?.apply { args.add("-proc:$this") } - config.annotationProcessors?.apply { - args.add("-processor") - args.add(indices.joinToString(",") { this[it] }) - } - config.processorPathEntries - ?.ifEmpty { null } - ?.let { - args.add("-processorpath") - args.add(getPathString(it)) - } - config.processorModulePathEntries - ?.ifEmpty { null } - ?.let { - args.add("--processor-module-path") - args.add(getPathString(it)) - } - if (config.isOptimize) args.add("-O") - if (config.isDebug) { - if (config.debugLevel?.isNotEmpty() == true) { - args.add("-g:" + config.debugLevel) - } else { - args.add("-g") - } - } - if (config.isVerbose) args.add("-verbose") - if (config.isParameters) args.add("-parameters") - if (config.isEnablePreview) args.add("--enable-preview") - config.implicitOption?.apply { args.add("-implicit:$this") } - if (config.isShowDeprecation) { - args.add("-deprecation") - config.isShowWarnings = true - } - if (!config.isShowWarnings) { - args.add("-nowarn") - } else { - val warnings = config.warnings - if (config.isShowLint) { - if (warnings.isNotEmpty()) { - args.add("-Xlint:$warnings") - } else { - args.add("-Xlint") - } - } - } - if (config.isFailOnWarning) args.add("-Werror") - if (config.releaseVersion?.isNotEmpty() == true) { - args.add("--release") - args.add(config.releaseVersion) - } else { - if (config.targetVersion?.isEmpty() == true) { - args.add("-target") - args.add("1.1") - } else { - args.add("-target") - args.add(config.targetVersion) - } - if (config.sourceVersion?.isEmpty() == true) { - args.add("-source") - args.add("1.3") - } else { - args.add("-source") - args.add(config.sourceVersion) + private fun getElideJavacVersion(executable: String): String? { + val cli = Commandline() + cli.setExecutable(executable) + cli.addArguments(arrayOf("javac", "--", "-version")) + val out = mutableListOf() + val err = mutableListOf() + try { + val exitCode = CommandLineUtils.executeCommandLine(cli, out::add, err::add) + if (exitCode != 0) { + throw CompilerException( + buildString { + append("Could not retrieve version from ") + append(executable) + append(". Exit code ") + append(exitCode) + append(", Output: ") + append(out.joinToString(System.lineSeparator())) + append(", Error: ") + append(err.joinToString(System.lineSeparator())) + } + ) } + } catch (e: CommandLineException) { + throw CompilerException("Error while executing the external compiler $executable", e) } - config.sourceEncoding - ?.ifEmpty { null } - ?.let { - args.add("-encoding") - args.add(it) - } - config.moduleVersion - ?.ifEmpty { null } - ?.let { - args.add("--module-version") - args.add(it) + return tryParseVersion(out) ?: tryParseVersion(err) + } + + private fun tryParseVersion(versions: List): String? { + for (version in versions) { + if (version.matches(VERSION_RE)) { + return version.substringBefore('.') } - config.customCompilerArgumentsEntries?.forEach { (key, value) -> - if (key.isEmpty() || key.startsWith("-J")) return@forEach - args.add(key) - if (value.isNotEmpty()) args.add(value) } - return args + return null } - @Throws(IOException::class) - private fun parseOutput(exitCode: Int, input: List): List { - // very lazy for now - val kind = if (exitCode == 0) CompilerMessage.Kind.NOTE else CompilerMessage.Kind.ERROR - return input.map { CompilerMessage(it, kind) } + companion object { + val VERSION_RE = "\\d+\\.\\d+\\.\\d+".toRegex() } } diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt index e8691f0..9a39519 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt @@ -60,16 +60,19 @@ open class ElideKotlinLifecycleParticipant : KotlinLifecycleParticipant() { T::class .java .getDeclaredMethod(name, *args.map { it.first }.toTypedArray()) - .apply { isAccessible = true } - .invoke(this, *args.map { it.second }.toTypedArray()) - .let { it as Boolean } + .run { + isAccessible = true + invoke(this@ElideKotlinLifecycleParticipant, *args.map { it.second }.toTypedArray()) as Boolean + } inline fun T.callPrivateFunc(name: String, vararg args: Pair, out Any?>) { T::class .java .getDeclaredMethod(name, *args.map { it.first }.toTypedArray()) - .apply { isAccessible = true } - .invoke(this, *args.map { it.second }.toTypedArray()) + .apply { + isAccessible = true + invoke(this@ElideKotlinLifecycleParticipant, *args.map { it.second }.toTypedArray()) + } } inline fun T.callArg() = Pair(T::class.java, this) From 4249ec4d9fb5a4c321a0a6b9e180655f251f091a Mon Sep 17 00:00:00 2001 From: melodicore Date: Mon, 11 May 2026 15:52:52 +0300 Subject: [PATCH 16/19] test: add some tests Signed-off-by: melodicore --- .github/workflows/job.build.yml | 13 ++-- Makefile | 34 ++++++++-- java-compiler/pom.xml | 39 +++++++---- .../maven/compiler/ElideJavacCompiler.kt | 2 +- java-compiler/src/test/kotlin/.gitkeep | 0 .../maven/compiler/ElideJavacCompilerTest.kt | 66 +++++++++++++++++++ kotlin-plugin/src/test/kotlin/.gitkeep | 0 .../plugin/kotlin/ElideKotlinPluginTest.kt | 57 ++++++++++++++++ 8 files changed, 187 insertions(+), 24 deletions(-) delete mode 100644 java-compiler/src/test/kotlin/.gitkeep create mode 100644 java-compiler/src/test/kotlin/dev/elide/maven/compiler/ElideJavacCompilerTest.kt delete mode 100644 kotlin-plugin/src/test/kotlin/.gitkeep create mode 100644 kotlin-plugin/src/test/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinPluginTest.kt diff --git a/.github/workflows/job.build.yml b/.github/workflows/job.build.yml index e2716b6..35e6baa 100644 --- a/.github/workflows/job.build.yml +++ b/.github/workflows/job.build.yml @@ -52,8 +52,13 @@ jobs: - name: "Build: Elide Plugin" run: ./mvnw clean install -pl elide-plugin - name: "Test: Java Compiler" - run: ./mvnw clean package exec:java -f sample-java + run: + ./mvnw test -pl java-compiler + ./mvnw clean package exec:java -f sample-java - name: "Test: Kotlin Plugin" - run: ./mvnw clean package exec:java -f sample-kotlin - - name: "Test: Mixed source" - run: ./mvnw clean package exec:java -f sample-mixed + run: + ./mvnw test -pl kotlin-plugin + ./mvnw clean package exec:java -f sample-kotlin + - name: "Test: Elide Plugin" + run: + ./mvnw clean package exec:java -f sample-mixed diff --git a/Makefile b/Makefile index c323cee..c843b7e 100644 --- a/Makefile +++ b/Makefile @@ -1,21 +1,41 @@ -all: clean install samples +all: clean all-java all-kotlin all-plugin clean: ./mvnw clean -install: java kotlin plugin +all-java: build-java test-java install-java sample-java -java: +all-kotlin: build-kotlin test-kotlin install-kotlin sample-kotlin + +all-plugin: build-plugin test-plugin install-plugin sample-plugin + +build-java: + ./mvnw compile -pl java-compiler + +build-kotlin: + ./mvnw compile -pl kotlin-plugin + +build-plugin: + ./mvnw compile -pl elide-plugin + +test-java: + ./mvnw test -pl java-compiler + +test-kotlin: + ./mvnw test -pl kotlin-plugin + +test-plugin: + ./mvnw test -pl elide-plugin + +install-java: ./mvnw install -pl java-compiler -kotlin: +install-kotlin: ./mvnw install -pl kotlin-plugin -plugin: +install-plugin: ./mvnw install -pl elide-plugin -samples: sample-java sample-kotlin sample-plugin - sample-java: ./mvnw clean package exec:java -f sample-java diff --git a/java-compiler/pom.xml b/java-compiler/pom.xml index 85fb791..8f4fdef 100644 --- a/java-compiler/pom.xml +++ b/java-compiler/pom.xml @@ -52,6 +52,8 @@ 6.0.3 3.5.5 4.0.3 + 1.5.0 + 33.6.0-jre @@ -90,22 +92,17 @@ plexus-utils ${plexusUtilsVersion} + + + com.google.guava + guava + ${guavaVersion} + test + - - org.jetbrains.kotlin - kotlin-test-junit5 - ${kotlinVersion} - test - - - org.junit.jupiter - junit-jupiter - ${junitVersion} - test - org.jetbrains.kotlin kotlin-stdlib @@ -126,5 +123,23 @@ plexus-compiler-javac ${plexusVersion} + + org.jetbrains.kotlin + kotlin-test-junit5 + ${kotlinVersion} + test + + + org.junit.jupiter + junit-jupiter + ${junitVersion} + test + + + org.codehaus.plexus + plexus-testing + ${plexusTestingVersion} + test + \ No newline at end of file diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt index 527c02a..22c3189 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt @@ -133,7 +133,7 @@ open class ElideJavacCompiler : JavacCompiler() { private fun getElideExecutable(config: CompilerConfiguration): String = config.executable ?: ElideLocator.locate()?.absolutePathString() ?: ELIDE_EXECUTABLE - private fun getElideJavacVersion(executable: String): String? { + internal fun getElideJavacVersion(executable: String): String? { val cli = Commandline() cli.setExecutable(executable) cli.addArguments(arrayOf("javac", "--", "-version")) diff --git a/java-compiler/src/test/kotlin/.gitkeep b/java-compiler/src/test/kotlin/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/java-compiler/src/test/kotlin/dev/elide/maven/compiler/ElideJavacCompilerTest.kt b/java-compiler/src/test/kotlin/dev/elide/maven/compiler/ElideJavacCompilerTest.kt new file mode 100644 index 0000000..22a6247 --- /dev/null +++ b/java-compiler/src/test/kotlin/dev/elide/maven/compiler/ElideJavacCompilerTest.kt @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2024-2026 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ +package dev.elide.maven.compiler + +import org.codehaus.plexus.testing.PlexusTest +import org.codehaus.plexus.util.cli.CommandLineUtils +import org.codehaus.plexus.util.cli.Commandline +import org.junit.jupiter.api.BeforeAll +import org.junit.jupiter.api.assertDoesNotThrow +import java.nio.file.Path +import kotlin.io.path.absolutePathString +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertNotNull +import kotlin.test.assertTrue + +/** + * Tests for the Elide Java Plexus Compiler. + * + * @author Lauri Heino + */ +@PlexusTest +class ElideJavacCompilerTest { + @Test + fun `can retrieve elide javac version`() { + val compiler = ElideJavacCompiler() + val version = assertNotNull(compiler.getElideJavacVersion(ELIDE_PATH.absolutePathString()), "Elide javac version could not be retrieved") + val versionInt = assertDoesNotThrow("Retrieved version should be an integer") { version.toInt() } + assertTrue(versionInt >= 25, "Retrieved version should be 25 or higher") + } + + companion object { + private lateinit var elidePath: Path + + val ELIDE_PATH by lazy { elidePath } + + val ELIDE_VERSION_RE = "\\d+\\.\\d+\\.\\d+(-.*)?".toRegex() + + @BeforeAll + @JvmStatic + fun `elide should be present for tests`() { + elidePath = assertNotNull(ElideLocator.locate(), "Elide binary was not found") + val cli = Commandline() + cli.executable = elidePath.absolutePathString() + cli.addArguments(arrayOf("--version")) + val out = CommandLineUtils.StringStreamConsumer() + assertDoesNotThrow("Could not run elide binary") { + val code = CommandLineUtils.executeCommandLine(cli, out, out) + assertEquals(0, code, "Elide binary produced an error: ${out.output}") + } + val lines = out.output.lineSequence().filter(String::isNotBlank).toList() + assertEquals(1, lines.size, "Output should contain a single non-blank line") + assertTrue(lines.first().trim().matches(ELIDE_VERSION_RE), "Output should be a valid Elide version") + } + } +} diff --git a/kotlin-plugin/src/test/kotlin/.gitkeep b/kotlin-plugin/src/test/kotlin/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/kotlin-plugin/src/test/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinPluginTest.kt b/kotlin-plugin/src/test/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinPluginTest.kt new file mode 100644 index 0000000..741813a --- /dev/null +++ b/kotlin-plugin/src/test/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinPluginTest.kt @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024-2026 Elide Technologies, Inc. + * + * Licensed under the MIT license (the "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * https://opensource.org/license/mit/ + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under the License. + */ +package dev.elide.maven.plugin.kotlin + +import org.apache.maven.project.MavenProject +import org.jetbrains.kotlin.cli.common.arguments.Argument +import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments +import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArgumentsConfigurator +import kotlin.test.Test +import kotlin.test.assertContains +import kotlin.test.assertEquals +import kotlin.test.assertNotEquals + +/** + * Tests for the Elide Kotlin Maven Plugin. + * + * @author Lauri Heino + */ +class ElideKotlinPluginTest { + @Test + fun `argument parser should parse arguments`() { + val arguments = MockCompilerArguments(CommonCompilerArgumentsConfigurator()) + arguments.someSpecialArgument = "gargantuan" + val project = MavenProject() + project.build.outputDirectory = "output/directory" + val parsedArguments = ArgumentParser.parseArguments("test", arguments, project) + assertEquals("test", parsedArguments[0]) + assertEquals("--", parsedArguments[1]) + assertContains(parsedArguments, "-XXspecial-argument=gargantuan") + val dIndex = parsedArguments.indexOf("-d") + assertNotEquals(-1, dIndex) + assertEquals("output/directory", parsedArguments[dIndex + 1]) + } + + class MockCompilerArguments(override val configurator: CommonCompilerArgumentsConfigurator) : CommonCompilerArguments() { + @Argument( + value = "-XXspecial-argument", + valueDescription = "", + description = "This is just for testing.", + ) + var someSpecialArgument: String? = null + set(value) { + checkFrozen() + field = if (value.isNullOrEmpty()) null else value + } + } +} From f284d07241d2b2d9f48138b7def562baf2118a0d Mon Sep 17 00:00:00 2001 From: melodicore Date: Mon, 11 May 2026 16:01:39 +0300 Subject: [PATCH 17/19] chore: fmt Signed-off-by: melodicore --- README.md | 4 +- .../resources/META-INF/plexus/components.xml | 382 +++++++++--------- .../dev/elide/maven/compiler/Constants.kt | 3 +- .../maven/compiler/ElideJavacCompiler.kt | 12 +- .../dev/elide/maven/compiler/ElideLocator.kt | 4 +- .../maven/compiler/ElideJavacCompilerTest.kt | 6 +- kotlin-plugin/pom.xml | 3 +- .../maven/plugin/kotlin/ArgumentParser.kt | 4 +- .../kotlin/ElideKotlinLifecycleParticipant.kt | 22 +- .../resources/META-INF/plexus/components.xml | 382 +++++++++--------- .../plugin/kotlin/ElideKotlinPluginTest.kt | 9 +- .../src/main/kotlin/com/sample/Library.kt | 2 +- 12 files changed, 413 insertions(+), 420 deletions(-) diff --git a/README.md b/README.md index 26071d0..24559a1 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ This plugin can be consumed in a Maven project to use [Elide](https://elide.dev) ### Elide Plugin -The easiest way to start using Elide in your project is the `elide-maven-plugin`. Enable it and set `extensions` to +The easiest way to start using Elide in your project is the `elide-maven-plugin`. Enable it and set `extensions` to `true` and all of your Java and Kotlin sources will be compiled with Elide `javac` and `kotlinc`. **`pom.xml`** @@ -39,7 +39,7 @@ The easiest way to start using Elide in your project is the `elide-maven-plugin` ### Kotlin drop-in replacement -If you already have a project that uses the `kotlin-maven-plugin`, you can use the `elide-kotlin-maven-plugin` as a +If you already have a project that uses the `kotlin-maven-plugin`, you can use the `elide-kotlin-maven-plugin` as a drop-in replacement. It supports all configuration you would expect from the Kotlin Maven plugin. **`pom.xml`** diff --git a/elide-plugin/src/main/resources/META-INF/plexus/components.xml b/elide-plugin/src/main/resources/META-INF/plexus/components.xml index d1dd132..0201e7d 100644 --- a/elide-plugin/src/main/resources/META-INF/plexus/components.xml +++ b/elide-plugin/src/main/resources/META-INF/plexus/components.xml @@ -1,206 +1,206 @@ - - - org.apache.maven.lifecycle.mapping.LifecycleMapping - jar - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - - default + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + jar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default - - - ${project.groupId}:${project.artifactId}:${project.version}:kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources - - - ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, - ${project.groupId}:${project.artifactId}:${project.version}:compile - - - ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources - - - ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, - ${project.groupId}:${project.artifactId}:${project.version}:test-compile - - - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test - - - org.apache.maven.plugins:maven-jar-plugin:3.3.0:jar - - - org.apache.maven.plugins:maven-install-plugin:3.0.1:install - - - org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy - - + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:test-compile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-jar-plugin:3.3.0:jar + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy + + - - - - + + + + - - org.apache.maven.lifecycle.mapping.LifecycleMapping - ejb - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - - default + + org.apache.maven.lifecycle.mapping.LifecycleMapping + ejb + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default - - - ${project.groupId}:${project.artifactId}:${project.version}:kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources - - - ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, - ${project.groupId}:${project.artifactId}:${project.version}:compile - - - ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources - - - ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, - ${project.groupId}:${project.artifactId}:${project.version}:test-compile - - - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test - - - org.apache.maven.plugins:maven-ejb-plugin:3.2.1:ejb - - - org.apache.maven.plugins:maven-install-plugin:3.0.1:install - - - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy - - + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:test-compile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-ejb-plugin:3.2.1:ejb + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + - - - - + + + + - - org.apache.maven.lifecycle.mapping.LifecycleMapping - war - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - - default + + org.apache.maven.lifecycle.mapping.LifecycleMapping + war + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default - - - ${project.groupId}:${project.artifactId}:${project.version}:kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources - - - ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, - ${project.groupId}:${project.artifactId}:${project.version}:compile - - - ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources - - - ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, - ${project.groupId}:${project.artifactId}:${project.version}:test-compile - - - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test - - - org.apache.maven.plugins:maven-war-plugin:2.2:war - - - org.apache.maven.plugins:maven-install-plugin:3.0.1:install - - - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy - - + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:test-compile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-war-plugin:2.2:war + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + - - - - + + + + - - org.apache.maven.lifecycle.mapping.LifecycleMapping - rar - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - - default + + org.apache.maven.lifecycle.mapping.LifecycleMapping + rar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default - - - ${project.groupId}:${project.artifactId}:${project.version}:kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources - - - ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, - ${project.groupId}:${project.artifactId}:${project.version}:compile - - - ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources - - - ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, - ${project.groupId}:${project.artifactId}:${project.version}:test-compile - - - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test - - - org.apache.maven.plugins:maven-rar-plugin:3.0.0:rar - - - org.apache.maven.plugins:maven-install-plugin:3.0.1:install - - - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy - - + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, + ${project.groupId}:${project.artifactId}:${project.version}:test-compile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-rar-plugin:3.0.0:rar + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + - - - - + + + + - - org.apache.maven.AbstractMavenLifecycleParticipant - kotlin - dev.elide.maven.plugin.ElideLifecycleParticipant - - + + org.apache.maven.AbstractMavenLifecycleParticipant + kotlin + dev.elide.maven.plugin.ElideLifecycleParticipant + + \ No newline at end of file diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt index e978302..b3437d6 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/Constants.kt @@ -15,5 +15,4 @@ package dev.elide.maven.compiler /** Constant ID used by the Elide compiler shim. */ const val ELIDE_COMPILER: String = "elide" -val ELIDE_EXECUTABLE: String = - if (System.getProperty("os.name").contains("windows", true)) "elide.exe" else "elide" +val ELIDE_EXECUTABLE: String = if (System.getProperty("os.name").contains("windows", true)) "elide.exe" else "elide" diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt index 22c3189..7758b17 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt @@ -108,14 +108,14 @@ open class ElideJavacCompiler : JavacCompiler() { .run { isAccessible = true @Suppress("UNCHECKED_CAST") - invoke(null, returnCode, BufferedReader(StringReader(out.output))) as MutableList + invoke(null, returnCode, BufferedReader(StringReader(out.output))) + as MutableList } - val last = out.output.lines().reversed().let { - for (line in it) { - if (line.isNotBlank()) return@let line + val last = + out.output.lines().reversed().let { + for (line in it) if (line.isNotBlank()) return@let line + "" } - "" - } if (last.isNotBlank()) { if (last.contains("✅")) messages.add(CompilerMessage(last, CompilerMessage.Kind.NOTE)) else if (last.contains("❌")) messages.add(CompilerMessage(last, CompilerMessage.Kind.ERROR)) diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt index 8be9607..536c740 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideLocator.kt @@ -23,9 +23,7 @@ import java.nio.file.Paths * @since 1.0.0 */ object ElideLocator { - /** - * Checks if a path is a valid binary. - */ + /** Checks if a path is a valid binary. */ private fun isValidElideBinary(path: Path): Boolean { return path.toFile().exists() && path.toFile().isFile && path.toFile().canExecute() } diff --git a/java-compiler/src/test/kotlin/dev/elide/maven/compiler/ElideJavacCompilerTest.kt b/java-compiler/src/test/kotlin/dev/elide/maven/compiler/ElideJavacCompilerTest.kt index 22a6247..559bc34 100644 --- a/java-compiler/src/test/kotlin/dev/elide/maven/compiler/ElideJavacCompilerTest.kt +++ b/java-compiler/src/test/kotlin/dev/elide/maven/compiler/ElideJavacCompilerTest.kt @@ -34,7 +34,11 @@ class ElideJavacCompilerTest { @Test fun `can retrieve elide javac version`() { val compiler = ElideJavacCompiler() - val version = assertNotNull(compiler.getElideJavacVersion(ELIDE_PATH.absolutePathString()), "Elide javac version could not be retrieved") + val version = + assertNotNull( + compiler.getElideJavacVersion(ELIDE_PATH.absolutePathString()), + "Elide javac version could not be retrieved", + ) val versionInt = assertDoesNotThrow("Retrieved version should be an integer") { version.toInt() } assertTrue(versionInt >= 25, "Retrieved version should be 25 or higher") } diff --git a/kotlin-plugin/pom.xml b/kotlin-plugin/pom.xml index d563968..87fc5a5 100644 --- a/kotlin-plugin/pom.xml +++ b/kotlin-plugin/pom.xml @@ -10,7 +10,8 @@ maven-plugin Elide Kotlin Maven Plugin - A drop-in replacement for the Kotlin Maven Plugin that uses Elide to compile Kotlin sources. + A drop-in replacement for the Kotlin Maven Plugin that uses Elide to compile Kotlin sources. + https://elide.dev diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt index 967c232..5b4cbcc 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ArgumentParser.kt @@ -12,11 +12,11 @@ */ package dev.elide.maven.plugin.kotlin -import java.lang.reflect.Field -import java.util.* import org.apache.maven.project.MavenProject import org.jetbrains.kotlin.cli.common.arguments.Argument import org.jetbrains.kotlin.cli.common.arguments.CommonCompilerArguments +import java.lang.reflect.Field +import java.util.* /** * Parser for Kotlin compiler arguments. diff --git a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt index 9a39519..19a5d8d 100644 --- a/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt +++ b/kotlin-plugin/src/main/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinLifecycleParticipant.kt @@ -57,22 +57,16 @@ open class ElideKotlinLifecycleParticipant : KotlinLifecycleParticipant() { name: String, vararg args: Pair, out Any?>, ): Boolean = - T::class - .java - .getDeclaredMethod(name, *args.map { it.first }.toTypedArray()) - .run { - isAccessible = true - invoke(this@ElideKotlinLifecycleParticipant, *args.map { it.second }.toTypedArray()) as Boolean - } + T::class.java.getDeclaredMethod(name, *args.map { it.first }.toTypedArray()).run { + isAccessible = true + invoke(this@ElideKotlinLifecycleParticipant, *args.map { it.second }.toTypedArray()) as Boolean + } inline fun T.callPrivateFunc(name: String, vararg args: Pair, out Any?>) { - T::class - .java - .getDeclaredMethod(name, *args.map { it.first }.toTypedArray()) - .apply { - isAccessible = true - invoke(this@ElideKotlinLifecycleParticipant, *args.map { it.second }.toTypedArray()) - } + T::class.java.getDeclaredMethod(name, *args.map { it.first }.toTypedArray()).apply { + isAccessible = true + invoke(this@ElideKotlinLifecycleParticipant, *args.map { it.second }.toTypedArray()) + } } inline fun T.callArg() = Pair(T::class.java, this) diff --git a/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml b/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml index 4ffd538..e06a6af 100644 --- a/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml +++ b/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml @@ -1,206 +1,206 @@ - - - org.apache.maven.lifecycle.mapping.LifecycleMapping - jar - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - - default + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + jar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default - - - ${project.groupId}:${project.artifactId}:${project.version}:kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources - - - ${project.groupId}:${project.artifactId}:${project.version}:compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile - - - ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources - - - ${project.groupId}:${project.artifactId}:${project.version}:test-compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile - - - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test - - - org.apache.maven.plugins:maven-jar-plugin:3.3.0:jar - - - org.apache.maven.plugins:maven-install-plugin:3.0.1:install - - - org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy - - + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-jar-plugin:3.3.0:jar + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy + + - - - - + + + + - - org.apache.maven.lifecycle.mapping.LifecycleMapping - ejb - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - - default + + org.apache.maven.lifecycle.mapping.LifecycleMapping + ejb + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default - - - ${project.groupId}:${project.artifactId}:${project.version}:kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources - - - ${project.groupId}:${project.artifactId}:${project.version}:compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile - - - ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources - - - ${project.groupId}:${project.artifactId}:${project.version}:test-compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile - - - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test - - - org.apache.maven.plugins:maven-ejb-plugin:3.2.1:ejb - - - org.apache.maven.plugins:maven-install-plugin:3.0.1:install - - - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy - - + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-ejb-plugin:3.2.1:ejb + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + - - - - + + + + - - org.apache.maven.lifecycle.mapping.LifecycleMapping - war - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - - default + + org.apache.maven.lifecycle.mapping.LifecycleMapping + war + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default - - - ${project.groupId}:${project.artifactId}:${project.version}:kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources - - - ${project.groupId}:${project.artifactId}:${project.version}:compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile - - - ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources - - - ${project.groupId}:${project.artifactId}:${project.version}:test-compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile - - - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test - - - org.apache.maven.plugins:maven-war-plugin:2.2:war - - - org.apache.maven.plugins:maven-install-plugin:3.0.1:install - - - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy - - + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-war-plugin:2.2:war + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + - - - - + + + + - - org.apache.maven.lifecycle.mapping.LifecycleMapping - rar - org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping - - - - default + + org.apache.maven.lifecycle.mapping.LifecycleMapping + rar + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default - - - ${project.groupId}:${project.artifactId}:${project.version}:kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources - - - ${project.groupId}:${project.artifactId}:${project.version}:compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile - - - ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - - - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources - - - ${project.groupId}:${project.artifactId}:${project.version}:test-compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile - - - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test - - - org.apache.maven.plugins:maven-rar-plugin:3.0.0:rar - - - org.apache.maven.plugins:maven-install-plugin:3.0.1:install - - - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy - - + + + ${project.groupId}:${project.artifactId}:${project.version}:kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + + + ${project.groupId}:${project.artifactId}:${project.version}:compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + + + ${project.groupId}:${project.artifactId}:${project.version}:test-kapt + + + org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + + + ${project.groupId}:${project.artifactId}:${project.version}:test-compile, + org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + + + org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + + + org.apache.maven.plugins:maven-rar-plugin:3.0.0:rar + + + org.apache.maven.plugins:maven-install-plugin:3.0.1:install + + + org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + + - - - - + + + + - - org.apache.maven.AbstractMavenLifecycleParticipant - kotlin - dev.elide.maven.plugin.kotlin.ElideKotlinLifecycleParticipant - - + + org.apache.maven.AbstractMavenLifecycleParticipant + kotlin + dev.elide.maven.plugin.kotlin.ElideKotlinLifecycleParticipant + + \ No newline at end of file diff --git a/kotlin-plugin/src/test/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinPluginTest.kt b/kotlin-plugin/src/test/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinPluginTest.kt index 741813a..23320ac 100644 --- a/kotlin-plugin/src/test/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinPluginTest.kt +++ b/kotlin-plugin/src/test/kotlin/dev/elide/maven/plugin/kotlin/ElideKotlinPluginTest.kt @@ -42,12 +42,9 @@ class ElideKotlinPluginTest { assertEquals("output/directory", parsedArguments[dIndex + 1]) } - class MockCompilerArguments(override val configurator: CommonCompilerArgumentsConfigurator) : CommonCompilerArguments() { - @Argument( - value = "-XXspecial-argument", - valueDescription = "", - description = "This is just for testing.", - ) + class MockCompilerArguments(override val configurator: CommonCompilerArgumentsConfigurator) : + CommonCompilerArguments() { + @Argument(value = "-XXspecial-argument", valueDescription = "", description = "This is just for testing.") var someSpecialArgument: String? = null set(value) { checkFrozen() diff --git a/sample-mixed/src/main/kotlin/com/sample/Library.kt b/sample-mixed/src/main/kotlin/com/sample/Library.kt index bb18a3f..95db1a3 100644 --- a/sample-mixed/src/main/kotlin/com/sample/Library.kt +++ b/sample-mixed/src/main/kotlin/com/sample/Library.kt @@ -2,4 +2,4 @@ package com.sample object Library { fun getHello(): String = "Hello, World!" -} \ No newline at end of file +} From e11c9ddde21e6926875b2a8052091252dbb44b49 Mon Sep 17 00:00:00 2001 From: melodicore Date: Mon, 11 May 2026 16:12:45 +0300 Subject: [PATCH 18/19] fix: fix ci Signed-off-by: melodicore --- .github/workflows/job.build.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/job.build.yml b/.github/workflows/job.build.yml index 35e6baa..1622ada 100644 --- a/.github/workflows/job.build.yml +++ b/.github/workflows/job.build.yml @@ -52,13 +52,12 @@ jobs: - name: "Build: Elide Plugin" run: ./mvnw clean install -pl elide-plugin - name: "Test: Java Compiler" - run: - ./mvnw test -pl java-compiler - ./mvnw clean package exec:java -f sample-java + run: ./mvnw test -pl java-compiler + - name: "Test: Java Compiler (Build Sample)" + run: ./mvnw clean package exec:java -f sample-java - name: "Test: Kotlin Plugin" - run: - ./mvnw test -pl kotlin-plugin - ./mvnw clean package exec:java -f sample-kotlin - - name: "Test: Elide Plugin" - run: - ./mvnw clean package exec:java -f sample-mixed + run: ./mvnw test -pl kotlin-plugin + - name: "Test: Kotlin Plugin (Build Sample)" + run: ./mvnw clean package exec:java -f sample-kotlin + - name: "Test: Elide Plugin (Build Sample)" + run: ./mvnw clean package exec:java -f sample-mixed From bfac39723ac0a2b274ea39cb0aa204ae687f24ed Mon Sep 17 00:00:00 2001 From: melodicore Date: Mon, 11 May 2026 17:43:44 +0300 Subject: [PATCH 19/19] chore: round 2 review comments Signed-off-by: melodicore --- elide-plugin/pom.xml | 17 +++++ .../resources/META-INF/plexus/components.xml | 48 +++++++------- .../maven/compiler/ElideJavacCompiler.kt | 7 +- kotlin-plugin/pom.xml | 9 +++ .../resources/META-INF/plexus/components.xml | 64 +++++++++---------- 5 files changed, 85 insertions(+), 60 deletions(-) diff --git a/elide-plugin/pom.xml b/elide-plugin/pom.xml index a155da8..45d319f 100644 --- a/elide-plugin/pom.xml +++ b/elide-plugin/pom.xml @@ -50,6 +50,17 @@ 3.5.5 3.15.0 4.0.3 + + 3.14.0 + + + 3.5.0 + 3.5.0 + 3.1.4 + 3.1.4 + 3.3.0 + 3.5.1 + 3.1.0 @@ -221,6 +232,12 @@ + + org.apache.maven.plugins + maven-compiler-plugin + ${mavenCompilerKotlinPluginVersion} + provided + org.apache.maven.plugin-tools maven-plugin-annotations diff --git a/elide-plugin/src/main/resources/META-INF/plexus/components.xml b/elide-plugin/src/main/resources/META-INF/plexus/components.xml index 0201e7d..5fc06bd 100644 --- a/elide-plugin/src/main/resources/META-INF/plexus/components.xml +++ b/elide-plugin/src/main/resources/META-INF/plexus/components.xml @@ -15,7 +15,7 @@ ${project.groupId}:${project.artifactId}:${project.version}:kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:resources ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, @@ -25,23 +25,23 @@ ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:testResources ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, ${project.groupId}:${project.artifactId}:${project.version}:test-compile - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + org.apache.maven.plugins:maven-surefire-plugin:${mavenTestPluginVersion}:test - org.apache.maven.plugins:maven-jar-plugin:3.3.0:jar + org.apache.maven.plugins:maven-jar-plugin:${mavenJarPluginVersion}:jar - org.apache.maven.plugins:maven-install-plugin:3.0.1:install + org.apache.maven.plugins:maven-install-plugin:${mavenInstallPluginVersion}:install - org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy + org.apache.maven.plugins:maven-deploy-plugin:${mavenDeployPluginVersion}:deploy @@ -64,7 +64,7 @@ ${project.groupId}:${project.artifactId}:${project.version}:kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:resources ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, @@ -74,23 +74,23 @@ ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:testResources ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, ${project.groupId}:${project.artifactId}:${project.version}:test-compile - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + org.apache.maven.plugins:maven-surefire-plugin:${mavenTestPluginVersion}:test - org.apache.maven.plugins:maven-ejb-plugin:3.2.1:ejb + org.apache.maven.plugins:maven-ejb-plugin:${mavenEjbPluginVersion}:ejb - org.apache.maven.plugins:maven-install-plugin:3.0.1:install + org.apache.maven.plugins:maven-install-plugin:${mavenInstallPluginVersion}:install - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + org.apache.maven.plugins:maven-deploy-plugin:${mavenDeployPluginVersion}:deploy @@ -113,7 +113,7 @@ ${project.groupId}:${project.artifactId}:${project.version}:kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:resources ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, @@ -123,23 +123,23 @@ ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:testResources ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, ${project.groupId}:${project.artifactId}:${project.version}:test-compile - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + org.apache.maven.plugins:maven-surefire-plugin:${mavenTestPluginVersion}:test - org.apache.maven.plugins:maven-war-plugin:2.2:war + org.apache.maven.plugins:maven-war-plugin:${mavenWarPluginVersion}:war - org.apache.maven.plugins:maven-install-plugin:3.0.1:install + org.apache.maven.plugins:maven-install-plugin:${mavenInstallPluginVersion}:install - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + org.apache.maven.plugins:maven-deploy-plugin:${mavenDeployPluginVersion}:deploy @@ -162,7 +162,7 @@ ${project.groupId}:${project.artifactId}:${project.version}:kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:resources ${project.groupId}:${project.artifactId}:${project.version}:compile-kotlin, @@ -172,23 +172,23 @@ ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:testResources ${project.groupId}:${project.artifactId}:${project.version}:test-compile-kotlin, ${project.groupId}:${project.artifactId}:${project.version}:test-compile - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + org.apache.maven.plugins:maven-surefire-plugin:${mavenTestPluginVersion}:test - org.apache.maven.plugins:maven-rar-plugin:3.0.0:rar + org.apache.maven.plugins:maven-rar-plugin:${mavenJarPluginVersion}:rar - org.apache.maven.plugins:maven-install-plugin:3.0.1:install + org.apache.maven.plugins:maven-install-plugin:${mavenInstallPluginVersion}:install - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + org.apache.maven.plugins:maven-deploy-plugin:${mavenDeployPluginVersion}:deploy diff --git a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt index 7758b17..48f83d9 100644 --- a/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt +++ b/java-compiler/src/main/kotlin/dev/elide/maven/compiler/ElideJavacCompiler.kt @@ -73,7 +73,7 @@ open class ElideJavacCompiler : JavacCompiler() { val argumentsFile = JavacCompiler::class .java - .getDeclaredMethod("createFileWithArguments", String::class.java.arrayType(), String::class.java) + .getDeclaredMethod("createFileWithArguments", Array::class.java, String::class.java) .run { isAccessible = true invoke(this@ElideJavacCompiler, args, config.buildDirectory.absolutePath) as File @@ -163,9 +163,8 @@ open class ElideJavacCompiler : JavacCompiler() { private fun tryParseVersion(versions: List): String? { for (version in versions) { - if (version.matches(VERSION_RE)) { - return version.substringBefore('.') - } + val match = VERSION_RE.find(version) ?: continue + return match.value.substringBefore('.') } return null } diff --git a/kotlin-plugin/pom.xml b/kotlin-plugin/pom.xml index 87fc5a5..16a649d 100644 --- a/kotlin-plugin/pom.xml +++ b/kotlin-plugin/pom.xml @@ -51,6 +51,15 @@ 3.5.5 3.15.0 4.0.3 + + + 3.5.0 + 3.5.0 + 3.1.4 + 3.1.4 + 3.3.0 + 3.5.1 + 3.1.0 diff --git a/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml b/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml index e06a6af..14eb5ed 100644 --- a/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml +++ b/kotlin-plugin/src/main/resources/META-INF/plexus/components.xml @@ -15,33 +15,33 @@ ${project.groupId}:${project.artifactId}:${project.version}:kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:resources ${project.groupId}:${project.artifactId}:${project.version}:compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerVersion}:compile ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:testResources ${project.groupId}:${project.artifactId}:${project.version}:test-compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerVersion}:testCompile - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + org.apache.maven.plugins:maven-surefire-plugin:${mavenTestPluginVersion}:test - org.apache.maven.plugins:maven-jar-plugin:3.3.0:jar + org.apache.maven.plugins:maven-jar-plugin:${mavenJarPluginVersion}:jar - org.apache.maven.plugins:maven-install-plugin:3.0.1:install + org.apache.maven.plugins:maven-install-plugin:${mavenInstallPluginVersion}:install - org.apache.maven.plugins:maven-deploy-plugin:3.0.0:deploy + org.apache.maven.plugins:maven-deploy-plugin:${mavenDeployPluginVersion}:deploy @@ -64,33 +64,33 @@ ${project.groupId}:${project.artifactId}:${project.version}:kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:resources ${project.groupId}:${project.artifactId}:${project.version}:compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerVersion}:compile ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:testResources ${project.groupId}:${project.artifactId}:${project.version}:test-compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerVersion}:testCompile - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + org.apache.maven.plugins:maven-surefire-plugin:${mavenTestPluginVersion}:test - org.apache.maven.plugins:maven-ejb-plugin:3.2.1:ejb + org.apache.maven.plugins:maven-ejb-plugin:${mavenEjbPluginVersion}:ejb - org.apache.maven.plugins:maven-install-plugin:3.0.1:install + org.apache.maven.plugins:maven-install-plugin:${mavenInstallPluginVersion}:install - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + org.apache.maven.plugins:maven-deploy-plugin:${mavenDeployPluginVersion}:deploy @@ -113,33 +113,33 @@ ${project.groupId}:${project.artifactId}:${project.version}:kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:resources ${project.groupId}:${project.artifactId}:${project.version}:compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerVersion}:compile ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:testResources ${project.groupId}:${project.artifactId}:${project.version}:test-compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerVersion}:testCompile - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + org.apache.maven.plugins:maven-surefire-plugin:${mavenTestPluginVersion}:test - org.apache.maven.plugins:maven-war-plugin:2.2:war + org.apache.maven.plugins:maven-war-plugin:${mavenWarPluginVersion}:war - org.apache.maven.plugins:maven-install-plugin:3.0.1:install + org.apache.maven.plugins:maven-install-plugin:${mavenInstallPluginVersion}:install - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + org.apache.maven.plugins:maven-deploy-plugin:${mavenDeployPluginVersion}:deploy @@ -162,33 +162,33 @@ ${project.groupId}:${project.artifactId}:${project.version}:kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:resources ${project.groupId}:${project.artifactId}:${project.version}:compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile + org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerVersion}:compile ${project.groupId}:${project.artifactId}:${project.version}:test-kapt - org.apache.maven.plugins:maven-resources-plugin:3.3.0:testResources + org.apache.maven.plugins:maven-resources-plugin:${mavenResourcesPluginVersion}:testResources ${project.groupId}:${project.artifactId}:${project.version}:test-compile, - org.apache.maven.plugins:maven-compiler-plugin:3.10.1:testCompile + org.apache.maven.plugins:maven-compiler-plugin:${mavenCompilerVersion}:testCompile - org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7:test + org.apache.maven.plugins:maven-surefire-plugin:${mavenTestPluginVersion}:test - org.apache.maven.plugins:maven-rar-plugin:3.0.0:rar + org.apache.maven.plugins:maven-rar-plugin:${mavenRarPluginVersion}:rar - org.apache.maven.plugins:maven-install-plugin:3.0.1:install + org.apache.maven.plugins:maven-install-plugin:${mavenInstallPluginVersion}:install - org.apache.maven.plugins:maven-deploy-plugin:3.3.0:deploy + org.apache.maven.plugins:maven-deploy-plugin:${mavenDeployPluginVersion}:deploy