We have multiple multi-module Maven projects with a KotlinJS Maven module (legacy compiler & Kotlin 1.7).
Is someone able to compile KotlinJS through Idea or Maven or command line with Incremental compilation and without Gradle and without NodeJS with a new IR Kotlin 1.9 compiler? Or maybe through some API so that we can build our own Maven Kotlin compiler plugin? thanks
Can I ask why you want to use Maven?
I'm a long time Maven user and plugins author and the QOL for Kotlin is drastically lower compared to Gradle.
11/02/2023, 6:48 PM
hi Edoardo, thanks!
Also see no option for incremental compilation 😞
We are including a KotlinJS based UI in existing Maven Java projects as a new modules. This makes integration with legacy projects straightforward, without having to change anything in CI pipelines or IDE.
Owners of those projects won't migrate them to Gradle as Maven works fine for them and we cannot force them.
Also until Kotlin 1.7 and old compiler everything was running smooth and incremental compilation from Idea was quite fast.
Also seems that compilation using Gradle is bit complicated as it requires NodeJS, webpack and other stuff and itis complicated to set it up in a restricted company environment with HTTP proxy and blocked Maven central repository. Everything has to go through controlled Maven company proxy.
Previous Maven based compilation was pretty smooth (apart from occasional NPE in Kotlion compiler 🙂 ) but we were able to live with that.
11/02/2023, 7:28 PM
Well NodeJS is used for running tests, and Webpack is optionally used only for the browser target. You can disable it.
How are you coding the KJS part without the Multiplatform plugin? You'll have a very "dumb" coding experience.
But if you can live without incremental compilation I'd say you can implement your Maven plugin, it should be straightforward once you understand the CLI options.
What about calling Gradle from the plugin and them moving the output to the desired folder?
You can setup the project to be self contained. Then have both a build.gradle and a POM for your Maven module.
11/02/2023, 7:57 PM
you mean to call gradle from maven plugin? is there a way to have maven plugin get gradle from maven repo, i.e. to avoid any self-downloading and avoid any npm/webpack stuff? Don't have any experience with gradle so far, so it is bit new to me
11/02/2023, 9:50 PM
You can store the Gradle distribution in your own servers and simply download from there.
You can operate on Gradle in offline mode to ensure nothing is downloaded (
Obviously, the Kotlin standard library and dependencies will have to be downloaded.
But, Gradle allows you to specify the Maven repositories it refers to. So you can swap Central with a custom one. Obviously it must contain all the necessary artifacts.