Questions tagged [gradle-kotlin-dsl]

Kotlin language support for Gradle build scripts.

Gradle build scripts have historically been written in Groovy. The Gradle Kotlin DSL project was created to create statically typed, clear, concise,and descriptive build scripts with awesome IDE support.

Build scripts are written in the Kotlin programming language, but using a Kotlin DSL (domain specific language) designed specifically to support building software.

Questions that belong here:

  • What causes a specific build script error?
  • How to convert a specific construct of a Groovy build script to its Kotlin equivalent?
  • How to achieve a specific processing task in your Kotlin build script?

Do not use this tag for general gradle questions.

Note: Before version 0.10.1 the "Gradle Kotlin DSL" project was called "Gradle Script Kotlin".

1145 questions
0
votes
1 answer

How to set up Kotlin PSI for IntelliJ IDEA Gradle Plugin?

I'm building a Plugin for the IntelliJ IDE to manipulate Kotlin files in a project. I've been able to write a bunch of tests to take a Kotlin file and generate a new file based on its contents. When I run this plugin in the IDE I'm unable to detect…
0
votes
2 answers

Overwite entire default Dockerfile generated by bmuschko Gradle Docker plugin

I am trying to overwrite the entire bmuschko generated Dockerfile in my Gradle script. However, all I can seem to do it just append to the bottom of it. I have a custom Dockerfile that I want to use, but using the plugin…
MeanwhileInHell
  • 6,780
  • 17
  • 57
  • 106
0
votes
1 answer

Running a Kotlin application from a build.gradle.kt script

I have build.gradle.kts file, I am trying to define a task which will call a Kotlin function to load a SQL script. tasks.register("dbTestDataLoader", JavaExec::class) { println("Running db test data") // starts postgresql service …
dustytrash
  • 1,568
  • 1
  • 10
  • 17
0
votes
1 answer

Gradle : How to translate some groovy code to kotlin

The groovy code below is working fine in a script build.gradle : task sourcesJar(type: Jar, dependsOn: classes) { from sourceSets.main.allSource classifier = 'sources' } artifacts { archives sourcesJar } I can't succeed in translating…
Emile Achadde
  • 1,715
  • 3
  • 10
  • 22
0
votes
1 answer

Gradle Kotlin Dsl Build for a Kotlin Gradle Plugin, which depends on a Groovy Class in the same Project

I have a Gradle plugin implemented with Kotlin, which is built with a gradle kotlin DSL build script. This works fine. The build script is as follows and is located in the buildSrc directory of project: plugins { groovy …
0
votes
1 answer

Kotlin DSL adding Kotlin SourceSets doesn't affect

I am adding Kotlin SourceSets to my project but I am unable to see Kotlin source in the Project layout. What I have in build.gradle.kts sourceSets { getByName("main").java.srcDirs("src/main/kotlin") } What I see in the project path And…
nuhkoca
  • 1,777
  • 4
  • 20
  • 44
0
votes
1 answer

How to solve : The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher.?

i have tried so many diffrent solutions on stack / git , none of them worked so far .. So the problem is when i'm trying to build my apk on release mode ofc , they shoot me with a problem which is basically about some compatibility i guess . *…
0 x 5 4 4 D
  • 177
  • 1
  • 13
0
votes
1 answer

Get the project instance from kotlin's gradle

I'm trying to migrate a script from Groovy's gradle to Kotlin's gradle. The function: def Group(Closure closure) { closure.delegate = dependencies return closure } ext { aGroup = Group { implementation xyz kapt xpto …
ademar111190
  • 14,215
  • 14
  • 85
  • 114
0
votes
0 answers

Specifying common plugin for all the subprojects in Gradle Multi Project Build

I have an empty root project and one subproject rootProject.name = "worder" include("worder-core") I want to make kotlin.jvm plugin to be common for all subprojects, build.gradle.kts(worder): plugins { id("org.jetbrains.kotlin.jvm") version…
0
votes
0 answers

How can source files containing specific content be excluded from a srcSet in Gradle (using Kotlin DSL)

I'd like to exclude some tests from a srcSet in Gradle. Basically integration tests and unit tests have been mixed up (there are thousands). I can tell which is which by looking at the content. If the content contains some specific code I know it's…
PaulNUK
  • 4,774
  • 2
  • 30
  • 58
0
votes
1 answer

Gradle - plugin task is not executed

I am really struggeling to get the bytecode enhancement via the hibernate gradle plugin to run. Especially as no examples I can find are written in Kotlin DSL, which we are using on the project. The relevant parts of the build.gradle.kts look as…
G.Brown
  • 214
  • 2
  • 12
0
votes
1 answer

What is configuration avoidance option to find exising task in Gradle's Kotlin DSL?

Using configuration avoidance API: the way to create a new task and configure it: val someLongTaskName by tasks.registering { // configure action here } while the way to configure an existing task: val anotherVeryLongTaskName =…
Alexander Vasiljev
  • 1,974
  • 3
  • 19
  • 27
0
votes
1 answer

Access ApplicationVariants in buildSrc

In my application, I manage all Gradle stuff in buildSrc. One of them is buildTypes. I am able to access all the properties that buildTypes provide. However, I cannot access applicationVariants in buildSrc. Is there any way to do so? Sample code…
nuhkoca
  • 1,777
  • 4
  • 20
  • 44
0
votes
1 answer

How to setup sqldelight in a kotlin multiplatform project with android, iOS and unsupported targets like mingwX64?

In the past we are working on a kotlin multiplatform project for mobile devices which uses sqldelight for database access. Now we want to add some native desktop targets like mingwX64 and linuxX64 but currently sqldelight doesn't available for these…
0
votes
0 answers

can't use 'springBoot' scope in kotlin build script

I have a question. There is a question about spring-boot-gradle-plugin. I written about spring boot example that allows the specified version (ex. 2.2.1.RELEASE). By the way, springBoot scope is not available when applying spring-boot-gradle-plugin…
WonChul Heo
  • 242
  • 1
  • 12