Full-stack Kotlin app with Maven?


I’m trying to create a full-stack project (as in, Kotlin/JVM in the backend and Kotlin/JS in the frontend), using IntelliJ IDEA and Maven.

But I haven’t found out any documentation or tutorials regarding doing this using Maven. All documentation and example projects available use Gradle.

So far, I know that using the kotlin-maven-plugin, and including the dependencies kotlin-sdlib and kotlin-sdlib-js work for each Kotlin backend singularly… but how can I do it for both JVM and JS backends?

Is it even possible to create a full-stack project with a single Maven module? Or should I rely on multiple Maven modules?

If you want to share code between the backend and frontend you have to use gradle. So far it’s the only supported build tool for multi-platform projects.

As of Kotlin 1.2, multiplatform projects have to be built with Gradle; other build systems are not supported.


1 Like

That is not strictly true. You need to use Gradle if you want to have a module with code that is compiled to both JavaScript and Java bytecode. Otherwise you can use Maven, you simply need to put your Kotlin-JS code and your Kotlin-JVM code in separate modules.

As an example this is a project I made quite a while ago (before there even was a possibility of multiplatform Gradle modules): JavaScriptLogger.

1 Like

That was exactly what I was looking for, thank you very much!