Kotlinc required with maven/ant?

I have a small project with mixed .java and .kt files. We’re going to deploy onto a linux server and had planned to create a simple custom build script, rather than relying on Ant/Maven. However, I just realized that the servers would not have kotlinc, and so we couldn’t complie the .kt files. Working in a large enterprise, it’s probably easier to just transcribe the kotlin files back to java and use javac than try to get the kotlin compiler installed on our servers.

My question: if I were to use maven/ant, would this circumvent the need to have kotlinc installed on these boxes, or would the build tool just be calling kotlinc under the hood anyway?

I always thought ‘deploy’ means that you take the compiled binaries and put them on server rather take the sources and compile them on server to get binaries.

But anyway, kotlinc is just a batch file that calls a java application. Is it really hard to get kotlinc along with your sources? AFAIK no install steps are required, just unpack kotlin-compiler.zip distribution and run bin/kotlinc from there.

You can get the latest kotlin-compiler.zip from github release page: Release 1.1.1 · JetBrains/kotlin · GitHub

You’re right- sorry, we’re going to “build” it on our dev server, not deploy it. You’re right, it’s probably easier to get it than I had envisioned…

Anyway, just for my knowledge, would a build tool still use the kotlin compiler under the hood? It must, right?

Maven or Gradle would automatically download kotlinc; you wouldn’t need a separate installation. For Ant, you’d need to provide the .jar files with the Kotlin compiler and Ant task definitions, but you can store them in the source code repository of your project if you need to.

1 Like