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 specify the entry point, Main-Class, for a FatJar using Gradle Kotlin DSL?

How do I specify the Main-Class attribute in the ShadowJar once it's imported? import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar plugins { kotlin("jvm") version "1.2.51" …
Thufir
  • 8,216
  • 28
  • 125
  • 273
0
votes
2 answers

Unresolved reference war.getWebAppDir()

In my project I apply the WAR plugin and have call war.getWebAppDir(). In Gradle 4.10.2 which has kotlin DSL 1.0-rc-6 that call works fine. But in Gradle 5.0-rc-3 which has Kotlin DSL 1.0.3 that call fails with the message Unresolved reference :…
Rahul Khimasia
  • 473
  • 12
  • 24
0
votes
2 answers

Kotlin DSL - union structure

I am designing a DSL and run into a requirement where I have a variable which could be assigned to different ways. Greatly simplified, I would like to set value property either by an integer or by an expression in String. (The real need is even more…
Balage1551
  • 1,037
  • 1
  • 10
  • 28
0
votes
1 answer

How to get versionName/versionCode from kotlin-dsl Gradle file in Gitlab ci script?

How can I get versionName and versionCode of my android project in Gradle(Kotlin-DSL) File from Gitlab ci script(gitlab-ci.yaml)? I have these two commands for getting them from gradle-groovy-dsl, but they don't work on gradle-kotlin-dsl. - export…
Ali
  • 331
  • 4
  • 15
0
votes
1 answer

within a kotlin lambda, how does a string accept a lambda?

In gradle-kotlin-dsl... this is valid code tasks { "build" { // inner lambda code here How can it work that a string can accept a lambda parameter, or else how is this syntax working? The string "build" seems to one of a list of strings…
innov8
  • 2,093
  • 2
  • 24
  • 31
0
votes
2 answers

Kotlin gradle script setup

I'm trying to compile simple Kotlin Gradle script. I've created a project in Idea with build.gradle.kts with following contents: group = "org.example" version = "1.0-SNAPSHOT" tasks { register("runScript", Copy::class) { from("data") …
vrfloppa
  • 374
  • 4
  • 14
0
votes
2 answers

gradle kotlin script configuration for javascript

For jvm i can use: plugins { kotlin("jvm") version "1.2.60" } I have found no equivanent string for "jvm" for use with javascript and am using the following: plugins { id("kotlin2js") version "1.2.60" } So the questions. Is there an…
innov8
  • 2,093
  • 2
  • 24
  • 31
0
votes
1 answer

gradle kotlin DSL scala & idea

How can I set idea { targetVersion = "13" } and sourceCompatibility = 1.8 from the scala plugin https://docs.gradle.org/current/userguide/scala_plugin.html when building using the gradle kotlin dsl?
Georg Heiler
  • 16,916
  • 36
  • 162
  • 292
0
votes
1 answer

How do you change the default Gradle wrapper and build file in IntelliJ?

I'm trying to switch over to Gradle Kotlin DSL from vanilla Gradle for all my IntelliJ/Kotlin projects. This requires me to specify the distributionUrl property in a Gradle wrapper task of the build file. However whenever I create a Gradle project…
0
votes
0 answers

how to add gradle (ideally using kotlin-dsl) to existing intellij python project

There are some quite useful previous questions (especially this one but it is out of date and not a direct answer. We have several python projects but are not moving into the world of kotlin. I am looking to unify tools somewhat by introducing…
innov8
  • 2,093
  • 2
  • 24
  • 31
-1
votes
1 answer

24 issues were found when checking AAR metadata:

pls kindly help. I have tried all suggestions on One or more issues found when checking AAR metadata values: none worked. I will appreciate your help. It synchronizes successfully but when run build it comes up with error 24 issues were found when…
Tope
  • 1
  • 2
-1
votes
1 answer

How do I declare extra properties in build.gradle.kts?

I want to write this Groovy in Kotlin code in the build.gradle.kts file at the top-level project. How do I write it correctly? build-script { ext { ... lifecycle_version = '2.5.1' } }
-1
votes
2 answers

Android studio not installing some specific packages

I want to install other pack ages apart from the ones that come with compose. Example: For lotties files animation implementation "com.airbnb.android:Lottie:3.7.1" And For curved bezier bottom app…
-1
votes
1 answer

How to read multiple spring profile files through @value annotation in Kotlin?

I have two spring profile files application-test.yml and application-prod.yml, with some properties in each file. I have set spring: profiles: active: test, prod in my application.yml file and added the @Profile(value= ["test", "prod"]) in…
Kate
  • 11
  • 5
-1
votes
1 answer

Facing this gradle build exception and problems

Tried every possible way and searched all the internet but it does not solve. this problem occurred suddenly on my multi-module project. I am using android studio and Kotlin as programming languages. so far I did every solution such as cleaning the…
1 2 3
76
77