How to add project reactor dependency in gradle.kts

Hi Gradle Community

I need help here in incorporating the following dependency in build.gradle.kts file

(this ‘gradle’ format)
implementation ‘io.projectreactor.kotlin:reactor-kotlin-extensions:1.0.1.RELEASE’

I need to learn how to provide the version here, as the following works (with no version input)

more, that doesn’t work either:

plugging {
kotlin(“io.projectreactor.kotlin”) version “1.0.2.RELEASE”

This is Groovy.

This is Kotlin.

This is looks similar to a plugin definition in Kotlin, but not valid code or what you want.

Just add the version to end of the dependency string in the Kotlin version, just like it is in the Groovy version. Change nothing else other than adding the :1.0.1.RELEASE to the end. Parenthesis and double quotes instead of single quotes are needed for Kotlin.

Thanks a lot, it worked,
Having said that, please if you could advise why then the format works for other such statements e.g:
plugins {

id(“io.spring.dependency-management”) version “1.0.9.RELEASE”


or this one below:
kotlin(“plugin.spring”) version “1.3.72” (that works)

That’s just the API and the languages being used (Groovy vs. Kotlin).

Plugins using the plugins {} block have an id and possibly a version, which is specifically implemented as a fluent interface, so id must be specified first before version or apply are even available to be called. The implementation in Kotlin is using infix functions as well, which slightly changes the syntax options.

Regular dependencies have a configuration and either a Map of values (such as group, artifactId, version, extension, etc.) or a single String that can be parsed into those elements. There’s various methods that can be called, but not a fluent interface.

The concepts might seem similar, and the syntaxes might seem arbitrary, but behind the scenes, this is all object-oriented programming. You can only call methods that exist on the underlying object that you’re working with, but languages offer more than one way to execute the same code.