https://kotlinlang.org logo
Title
w

witoldsz

06/08/2017, 8:37 PM
Hi! What would you suggest using to build a Kotlin project? My only requirement is to be able to use external libraries, like jOOQ, Postgres drivers etc… In Java-land almost every lib is available in Maven repository. Can I use libraries from Maven central using Kotlin command line tools? Or should I use Maven or Gradle? What do you use?
o

orangy

06/08/2017, 8:45 PM
Maven or Gradle, or even Ant would work. You can also try #kobalt. Some people even use make.
r

Ruckus

06/08/2017, 8:56 PM
Don't forget bazel
🤔 1
o

orangy

06/08/2017, 8:58 PM
Or blaze?
w

witoldsz

06/08/2017, 9:08 PM
I could use Make(file) with
kotlinc
, but how would I import a 3rd party lib from maven repository?
o

orangy

06/08/2017, 9:17 PM
If you choose to use make, you will have to download it manually from Maven central, I suppose. Make doesn’t have package management capabilities.
Probably there is a command line tool that you can integrate with Make, which will download dependencies, etc. But then I’d just use Maven.
w

witoldsz

06/08/2017, 9:21 PM
My initial
pom.xml
is now 160 lines long. I am (slowly) getting sick of all that huge pom-spaghetti. Especially in a µservices environment when you have many little modules and each JVM one has hundreds of lines in poms… Gradle seems promising as far as I can see…
o

orangy

06/08/2017, 9:24 PM
Are you using parent/child pom hierarchy? It saves a lot of repetitive text. Gradle is also good, especially with Kotlin scripting (#gradle)
w

witoldsz

06/08/2017, 9:24 PM
36 lines of XML just to configure Liquibase… even more to configure jOOQ code generator. In Makefile it would be like 4 lines…
o

orangy

06/08/2017, 9:31 PM
That probably wouldn’t be 4 lines, I think. But even doing reasonably good java compilation with Make would be huge work. Java has to compile the whole program, unlike C/C++. You can’t normally compile .java files one by one. So you will have to build up some sort of “gather all .java files for a module” logic, and then you will need to do it incrementally, etc, etc. Just use tools that are built for this kind of systems.
w

witoldsz

06/08/2017, 9:39 PM
There are going to be no more than few
.kt
files, even one will work for now, but you are right, the build tool would be better.
o

orangy

06/08/2017, 9:48 PM
Well, then probably a shell script is ok 🙂 Like https://github.com/holgerbrandl/kscript
w

witoldsz

06/08/2017, 9:58 PM
This looks crazy, I will have to evaluate it before Gradle 🙂
c

cedric

06/09/2017, 12:03 AM
@witoldsz Is your project on github or somewhere so I can take a look at your build file?
w

witoldsz

06/09/2017, 12:26 AM
No, it's a commercial product, it has no one, single build file. The question of this topic was about a microservice, so it's like a tiny block of a bigger picture created of like > 40. I am evaluating Kotlin to be one of them.