Skip to content

drmaas/ratpack-kotlin

Repository files navigation

ratpack-kotlin

build
forthebadge

Project Status

This project is in maintenance mode. PRs and issues are welcome, but my time will be limited to defect fixes and other critical maintenance as needed.

For users looking to user ratpack and kotlin together, I recommend using the outstanding library http4k with ratpack as a server backend. More details can be found in the server backend implementation.

Overview

Build fluent kotlin ratpack applications. Features:

  • Server, Bindings, Chain, and Handler DSL

  • RxJava extension functions

  • RxJava2 extension functions

  • Reactor extension functions

  • Coroutine functions

  • Kotlin test harnessing support: KotlinEmbeddedApp, kotlinApplicationUnderTest(…​) and friends

Usage

  • Gradle plugin (kotlin syntax)

plugins {
  id("me.drmaas.ratpack-kotlin") version "x.y.z"
}

src/ratpack/ratpack.kts

import ratpack.kotlin.handling.ratpack

ratpack {
  serverConfig {
    port(8080)
  }
  bindings {
    bindInstance("string")
  }
  handlers {
    get("test") {
      render(get(String::class.java))
    }
  }
}

All libraries are available in maven central.

Gradle

compile 'me.drmaas:ratpack-kotlin-<module>:x.x.x'

Maven

<dependency>
  <groupId>me.drmaas</groupId>
  <artifactId>ratpack-kotlin-<module></artifactId>
  <version>x.x.x</version>
</dependency>

Local Setup

This project requires java11.

sdk install java 11.0.15-tem

Then:

./gradlew check

Building and Releasing

./gradlew -Prelease.scope=patch clean build install final publishPlugins uploadArchives