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
0 answers

How to configure kotlin test output in kotlin gradle DSL?

I have let gradle generate a gradle app for me (gradle init --type=kotlin-application). It users kotlin-test (org.jetbrains.kotlin:kotlin-test) as test framework. However, when I invoke "./gradlew build" and a test fails, I get output where the…
eekboom
  • 5,551
  • 1
  • 30
  • 39
0
votes
2 answers

how to break from lambda passed to recursive function when provided condition met

I am writing a custom loop dsl and I want it's usage to look like below var counter1 = 0 var counter2 = 0 loop { counter1 += 1 println(counter1) stopIf(counter1 == 5) // loop should terminate here and…
Pritam Kadam
  • 2,388
  • 8
  • 16
0
votes
1 answer

ClassNotFoundException exception when using library

I created a common library to use it in my spring microservices. In this library I used some other libraries (example: libphonenumber). I created the jar file and imported it into another project, and I used it without any problem. But when building…
user10256891
0
votes
1 answer

Importing members from multiple classes in single function to build kotlin dsl

I have a special use case to provide dsl to our library consumer. I want to expose single function and inside that function, I want all the required utilities are imported. Because of some restriction I can not aggregate all the utilities in…
Pritam Kadam
  • 2,388
  • 8
  • 16
0
votes
0 answers

Lazy evaluation of computed project.version

I'm trying to use the Jgitver Gradle Plugin together with the BuildConfig Gradle Plugin but I'm not getting the version in the generated BuildConfig class. Instead I get Unspecified. This is because of ordering and so far I wasn't able to get the…
Rolf W.
  • 1,379
  • 1
  • 15
  • 25
0
votes
0 answers

What are the requirements for gradle.kts generated by spring initializr?

I modified the build.gradle file of the newly created gradle project named build.gradle.kts, and then copied the build.gradle.kts content of the demo project generated by spring initializr, and then build, this file reported a lot of errors, but…
0
votes
1 answer

How to import amazon s3 for spring boot using gradle kotlin dsl

I have tried to import s3 in my spring boot project following the instructions on the official docs but the dependencies aren't being resolved. https://docs.aws.amazon.com/sdk-for-java/v2/developer-guide/setup-project-gradle.html I updated the…
0
votes
1 answer

Externalize plugin versions in kotlin gradle dsl?

I would like to externalize plugin versions. I've tried import org.jetbrains.kotlin.gradle.tasks.KotlinCompile object DependencyVersions { const val SPRING_BOOT_VERSION = "2.1.6.RELEASE" const val DEPENDENCY_MANAGEMENT_VERSION =…
pixel
  • 24,905
  • 36
  • 149
  • 251
0
votes
1 answer

Why is Gradle failing on :linkDebugTestLinux in my Kotlin multiplatform project?

I'm porting a C# library to Kotlin to take advantage of multiplatform. When running the build task, it fails in the subtask linkDebugTestLinux. For context, I'm using IDEA Ultimate on Manjaro. I'm certain there's nothing wrong with my code as…
James Groom
  • 235
  • 2
  • 6
0
votes
2 answers

Dropwizard + Gradle fatJar for project with subprojects pulls in gradle-api-5.4.1.jar deps

I have a Gradle project that as a simple example looks similar to this: root | |build.gradle.kts |settings.gradle.kts |config.yaml |web/ |build.gradle.kts |src/ |main/ |java....(etc) The web project is a barebones…
Mustafa Shabib
  • 798
  • 12
  • 35
0
votes
1 answer

war file huge after upgrading to gradle-5

I have a multi-module-gradle-build. Some projects have a build.gradle, others have a build.gradle.kts. Upgrading gradle from 4.10 to 5.4.1 has a strange effect on war projects if and only if they are defined in build.gradle.kts. $ unzip -l…
Frank Neblung
  • 3,047
  • 17
  • 34
0
votes
1 answer

Generating resources in AAR using gradle as part of the application

I got library which includes some resource generating. I have the task for doing generating resources: val updateWidgetResourcesProvider = tasks.register("updateWidgetResources") { from("../../widget/") include("*.png") …
Shchvova
  • 458
  • 5
  • 15
0
votes
0 answers

How to replace yaml file properties with default value?

I have the following kts Gradle configuration of the web application: tasks.withType { filesMatching("application-test.yaml") { expand(project.properties) } } The application-test.yaml looks…
Eugene Ustimenko
  • 322
  • 4
  • 16
0
votes
2 answers

Gradle kotlin in Gradle5.2 Unresolved reference: dependtest

A multi module project with Kotlin source code, which used to work, stops working after upgrading to Gradle 5.2, because the Kotlin classes from the compile project('depend-test') dependency are not found. Attempted to change plugin version already…
Rainy
  • 1
  • 1
  • 1
0
votes
1 answer

How to define ANDROID_HOME before the project configuration phase in Android Gradle projects?

When building an Android application with Gradle we need to point the ANDROID_HOME to our build. Maybe using an environment variable or something in the local.properties file. I'm trying to find a way to automatically define and use this, if…