Execute Kotlin Scripts with Gradle

Execute Kotlin Scripts with Gradle

Gradle, Kotlin, Software Development, Teaching, Tutorial
Organize Kotlin Scripts as Gradle tasks In this article, you will learn how you can organize multiple Kotlin scripts as Gradle tasks and make them easily executable this way. I've found a discussion about this here. Somebody wanted to execute Kotlin scripts with Gradle build scripts which is, of course, possible by using kotlinc as shown in this (Groovy) build script. This doesn't look very pretty though, and, as described in the corresponding thread, isn't very performant and manageable. Another solution would be to use Gradle scripts written with the Kotlin DSL and define custom tasks within a build.gradle.kts file, which obviously can hold and run Kotlin code naturally: // build.gradle.kts // // Execute Kotlin task with: gradle -q foo task("foo") { group = "com.kotlinexpertise" description = "my foo task"…
Read More
Publish Kotlin Library on Bintray using Gradle Kotlin DSL and Travis CI

Publish Kotlin Library on Bintray using Gradle Kotlin DSL and Travis CI

Gradle, Java, Kotlin, Software Development, Tutorial
Distribute a Library on Bintray using Gradle Kotlin DSL In my latest blog post, published a few weeks back, I informed about the usage of the Gradle Kotlin DSL and how it helps with describing build scripts. In another earlier post, I introduced a small library that can be utilized for simplifying the creation of TLS/SSL sockets using a custom Kotlin DSL: SeKurity. In this post, we'll investigate how such a library can be made available to others that actually want to make use of it inside other projects. Ultimately, it should be possible to list the SeKurity library as a simple dependency in a build script like Maven or Gradle. Since the library itself is already backed by Gradle, I'll show a way of publishing the resulting artifacts at…
Read More