Kotlin Maven generate jar project


Hi folks

I’ve returned to development a new project with kotlin, the target is generate a microservice with spark and somethings OS functionalities, but I feel really noob in kotlin with maven.

I want to create the project that allow me generate final executable with this structure:

├── bin
│ └── app.jar
├── config
├── db
├── libs
└── log

Someone have a example, guide, tutorial or something that help me?



You get the basics for using Kotlin with Maven here: Kotlin and Maven

As for the custom directory structure, it’s not dependent on the language, so check Maven Docs, for example: Using Maven When You Can’t Use the Conventions or Maven Resource Plugin and Maven Assembly Plugin.


Thanks for the info, I’ll review, in this days I read about the differences to gradle and maven (currently I know something of maven, but nothing bout gradle), do you have experience about this?



You can find the documentation form using Kotlin with Gradle here: Kotlin and Gradle and here: Kotlin meets Gradle is an article about writing gradle build scripts in Kotlin instead of Groovy.

Here are a couple pages with Maven and Gradle comparisons: Maven vs Gradle, Gradle vs Maven performance and Gradle vs Maven.

I have more experience with Maven than Gradle, but from what I can tell Gradle can do all that Maven can, so for most project they are interchangeable. That being said, since Gradle builds are configured using either Kotlin or Groovy scripts rather than XML files like Maven, you can conceivably implement any kind of structure for a project, use any of the Java libraries available (without having to write your own plugin around it like with Maven), run ant command-line tool you want and, most importantly, use it to create build in any programming language there is.