Questions tagged [kotlin-dsl]
68 questions
31
votes
3 answers
How to exclude library from all dependencies in Kotlin DSL build.gradle?
I started migration from build.gradle (Groovy) to build.gradle.kts (Kotlin DSL). The thing is that com.google.common.util.concurrent.ListenableFuture (from com.google.guava) exists in several dependecies. Because of that build fails with…

Demigod
- 5,073
- 3
- 31
- 49
12
votes
3 answers
Android specific flavor dependency via Kotlin DSL
Inside build.gradle we could
productFlavors {
free {
dimension "tier"
}
}
Then
dependencies { freeDebugImplementation "com.someDependency:free-debug:1.0.0";}
BUT when I use Kotlin DSL, inside build.gradle.kts, I…

Neil G
- 203
- 1
- 7
9
votes
2 answers
How to conditionally accept Gradle build scan plugin terms of service in Kotlin DSL?
This basically extends this question to Kotlin DSL instead of Groovy DSL:
How does the Groovy DSL solution of
if (hasProperty('buildScan')) {
buildScan {
termsOfServiceUrl = 'https://gradle.com/terms-of-service'
…

sschuberth
- 28,386
- 6
- 101
- 146
6
votes
0 answers
How do you split large kotlin based Gradle build files with variables?
I have a large gradle.build.kts file and I'm trying to break it into smaller pieces using apply(from = "xxx") (I'm open to better solutions if one exists).
The problem is that I've run into a problem where one of my scripts cant handle variables. …

JDMcMillian
- 219
- 1
- 7
5
votes
0 answers
WARNING: Unsupported Kotlin plugin version
The embedded-kotlin and kotlin-dsl plugins rely on features of Kotlin 1.4.31 that might work differently than in the requested version 1.5.21
How to set embedded-kotlin and kotlin-dsl to version 1.5.21 ?

jitendra kumar
- 2,161
- 2
- 7
- 12
5
votes
1 answer
How to access Kotlin DSL extensions from non-build-gradle file?
There are few Kotlin Extensions that come along with org.gradle.kotlin.dsl like
android or publishing etc. Say, for publishing, the extension is defined as below
fun org.gradle.api.Project.`publishing`(configure:…

musooff
- 6,412
- 3
- 36
- 65
4
votes
1 answer
Adding Kotlin plugins using plugins DSL
It looks like there are two ways of declaring some Kotlin plugins using plugins DSL: Using the id() method and the kotlin() method. For example, the android plugin can be added using either id("kotlin-android") or kotlin("android"). This is also the…

imashnake_
- 171
- 9
4
votes
1 answer
Is there a way to generate kotlin dsl using data
We are using kotlin dsl to as a user friendly builder to take input and generate data. Is there a way to do the opposite of that ?
ie, convert existing data into dsl ?
Can this kotlin representation be converted to dsl ?
val person = Person("John",…

sdb
- 327
- 3
- 12
4
votes
1 answer
How to convert bootRepackage task to kotlin DSL in gradle 5.0.0?
Looking to create a spring boot fat jar, but unsure how to convert the bootRepackage task found here in my build.kts file:
bootRepackage {
mainClass = 'demo.Application'
}

Clement
- 4,491
- 4
- 39
- 69
3
votes
1 answer
Android Build with Kotlin DSL - how to access flavor extra properties?
Traditionally, in Groovy, it was possible to define flavor-specific variables in the ext
{} block, but switching to Kotlin DSL it seems that the extra map has the project scope.
It looks like it is possible to force a flavor scope for extras by…

Mcingwe
- 2,070
- 2
- 18
- 17
3
votes
1 answer
Kotlin - DSL Color Style
When you annotate an annotation class in Kotlin with @DslMarker, an icon appears in the gutter indicating the DSL style
When I try to change the style to a different color it doesn't do anything. How does Kotlin choose the DSL style, and how do I…

Matthew Layton
- 39,871
- 52
- 185
- 313
3
votes
1 answer
Unable to resolve dependency as a result of conversion to using Gradle Kotlin DSL
Having converted my original Kotlin Gradle scripts from using groovy to using Kotlin DSL using the following articles as references:
A Better way to Manage Gradle Build Script
and Migrating Gradle Build Scripts to Kotlin DSL. After compiling my code…

George
- 2,865
- 6
- 35
- 59
2
votes
0 answers
Unable to change gradle plugin repository
TLDR: I want to download plugin id("org.gradle.kotlin.kotlin-dsl") using proxy.
I work in a big corporation and there are strict rules regarding internet access.
I have to download every library using corpo proxy.
Lately I've implemented buildSrc,…

TheD3luxed
- 178
- 1
- 8
2
votes
0 answers
Does Android Jetpack Navigation Kotlin DSL support bottom navigation with multiple stack?
I am using latest Jetpack Navigation with native support of multiple stack for bottom navigation: https://medium.com/androiddevelopers/navigation-multiple-back-stacks-6c67ba41952f and it works fine. The only limitation for me that I have to define…

vt600c
- 181
- 1
- 7
2
votes
1 answer
How to specify Maven settings.xml for Kotlin DSL project in TeamCity
So you can have settings.xml for Maven projects in TeamCity, Administration -> Project -> Maven Settings.
You can also store project configuration as Kotlin DSL, which is basically a Maven project stored under .teamcity in VCSROOT. It may even use…

alamar
- 18,729
- 4
- 64
- 97