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

Kotlin multiplatform: Skipping publish of some platforms using Gradle Kotlin dsl

I have Kotlin multiplatform project. And I would like to publish part artifacts to repository, skipping another part. I am using following config: kotlin { jvm() val iosArm64 = iosArm64() val iosX64 = iosX64() …
Pavel
  • 653
  • 2
  • 11
  • 31
0
votes
1 answer

Set Gradle custom task inputs and outputs

I am writing a Gradle plugin in Kotlin, adding a custom task. How do I go about declaring the task's inputs and outputs?
Vic Seedoubleyew
  • 9,888
  • 6
  • 55
  • 76
0
votes
1 answer

android studio go to declaration not working for buildSrc

I am following this tutorial to do Gradle Dependency Management: Using Kotlin and buildSrc for build.gradle Autocomplete in Android Studio in Dependencies.kt file object Versions { const val support_lib = "22.0.0" const val…
Xianwei
  • 2,381
  • 2
  • 22
  • 26
0
votes
1 answer

dependencies added in subprojects.forEach in gradle multi-module kotlin DSL is not visible to sub projects

I have multi-module gradle project with kotlin dsl called stream-data-processing. It is in github here. The build.gradle.kts file of root project is - plugins { base java } allprojects { group =…
user51
  • 8,843
  • 21
  • 79
  • 158
0
votes
2 answers

Make custom Gradle task, that generates code, run on IDE import

Since there is no Gradle plugin for axis2 (a wsdl code generator), I called an Ant task in a custom Gradle task. As of now ./gradlew build generates the code, and ./gradlew clean deletes it. Also, the code is only generated if changes in the input…
mike
  • 4,929
  • 4
  • 40
  • 80
0
votes
2 answers

How to access tests jar in gradle in multi-module project

I have multimodule project. From one of the modules I need to refer the test classes from other module. I tried to configure like this: // core project val testJar by tasks.registering(Jar::class) { archiveClassifier.set("tests") …
Izbassar Tolegen
  • 1,990
  • 2
  • 20
  • 37
0
votes
2 answers

Spring boot failing to resolve spring-boot-dependencies using gradle kotlin dsl

The build.gradle.kts file looks like this: buildscript { val springBootVersion by extra("2.1.3.RELEASE") repositories { mavenCentral() } dependencies { …
0
votes
1 answer

How to configure IDEA for separated subproject dependency with gradle

I have a special project structure: root project + sub project 1 + sub project 2 The subprojects are represent "plugins": part of the application built into separated jar and scanned dynamicly by root project at run time when deployed.…
Balage1551
  • 1,037
  • 1
  • 10
  • 28
0
votes
1 answer

Gradle Kotlin DSL: Extract contents from dependency

How do I convert the following snippet (based on the one by Peter Niederwieser) to Kotlin? configurations { assets } dependencies { assets 'somegroup:someArtifact:someVersion' } task extractApi(type: Sync) { dependsOn…
Michel Krämer
  • 14,197
  • 5
  • 32
  • 32
0
votes
1 answer

Writing proper DSL

I want to be able to write that calls a factory method to create an instance of a object instead of directly calling the constructor. I have a factory named, PersonFactory that implements a method called getPresonTypeOne(name: String, age:Int,…
0
votes
1 answer

SaxonParserTest missing SaxonXQDataSource?

Looking to run the simplest possible example using saxon, and, specifically, Saxon-HE: thufir@dur:~/NetBeansProjects/helloWorldSaxon$ thufir@dur:~/NetBeansProjects/helloWorldSaxon$ gradle clean run > Task :compileJava…
Thufir
  • 8,216
  • 28
  • 125
  • 273
0
votes
1 answer

Gradle Kotlin: Could not find net.sf.saxon:saxon-HE:9.9.0-2

Saxon doesn't seem to be where gradle is trying to send it: Not Found For request 'GET /artifact/net/sf/saxon/saxon-HE/9.9.0-2/saxon-HE-9.9.0-2.pom' The actual URL is, or looks to be, ../artifact/net.sf.saxon/.. rather than ..artifact/net/saxon..…
Thufir
  • 8,216
  • 28
  • 125
  • 273
0
votes
1 answer

Could not find javax.xml.xquery:xqj-api:1.0

The maven repo is added correctly, and is required? If so, what's the syntax to add xqj? exception: thufir@dur:~/NetBeansProjects/helloWorldBaseX$ thufir@dur:~/NetBeansProjects/helloWorldBaseX$ gradle clean run > Task :compileJava FAILED FAILURE:…
Thufir
  • 8,216
  • 28
  • 125
  • 273
0
votes
1 answer

Stackoverflow error when uses Apache Jmeter Core

I am new in Gradle. I am using my gradle with kotlin dsl script. When I execute using gradle bootRun Then it throw StackoverFlow error for log4J Exception in thread "main" java.lang.StackOverflowError at …
user6457056
0
votes
1 answer

How to convert Gradle Groovy method in root build.gradle to Gradle Kotlin DSL function in build.gradle.kts

In Gradle Groovy root build.gradle I have some method defined. For example: File[] getFiles(String path) { // do some filtering here and return result array return result } In module build.gradle I have some task defined which calls method…