https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
gradle
  • b

    Bernhard

    09/04/2018, 7:21 AM
    hi what would you recommend to pass parameters to a task
    g
    • 2
    • 4
  • b

    bdawg.io

    09/06/2018, 1:27 AM
    You can write a Gradle plugin that does everything instead and then you would just need to apply that plugin, not very recommended
    g
    n
    • 3
    • 10
  • m

    mp

    09/06/2018, 8:42 AM
    hi there - I can't clarify the behavior of
    buildSrc/build.gradle.kts
    - does it affects onto main
    build.gradle.kts
    ? because when I add
    buildSrc/build.gradle.kts
    and try to define some dependencies for my plugin - main file becomes "red"
    g
    n
    • 3
    • 27
  • v

    vpriscan

    09/06/2018, 3:27 PM
    I have a question about maven
    i
    • 2
    • 1
  • v

    vpriscan

    09/06/2018, 3:28 PM
    what is "Replacing default-compile as it is treated specially by maven" supposed to mean
    i
    • 2
    • 1
  • p

    pavel.v

    09/06/2018, 6:56 PM
    Hi, I got problem with configuring plugin extension. I can only configure it using configure function with plugin extension type parameter. When i use it like kotlin extension function gradle shows errors. I am using latest gradle version.
    -.txt
    g
    • 2
    • 8
  • j

    jmfayard

    09/07/2018, 1:00 PM
    Is there a kotlin equivalent for creating a simple task without using the (IMHO unintuitive) doLast syntax?
    task helloworld << {
        println("hello world")
    }
    e
    • 2
    • 1
  • c

    colljos

    09/11/2018, 9:03 AM
    How does one use the
    internal
    keyword inside the same module for say
    integrationTests
    (eg. as per the above definition it can be used across
    main
    and
    unit
    in the same module)?
    i
    j
    • 3
    • 4
  • r

    rkeazor

    09/11/2018, 11:59 AM
    Hey guys quick question. I'm separated my gradle dependencies into a kotlin file using buildSrc and kotlin plugin. It works fine. Downloads the dependencies properly and everything. But once I invalidate caches, it no longer works. Is there something I'm missing?
    g
    • 2
    • 2
  • u

    user

    09/12/2018, 12:09 PM
    1.0-RC6 Gradle Kotlin DSL 1.0 RC6 Release Notes Gradle Kotlin DSL 1.0 RC6 brings Kotlin 1.2.61, support for configuration avoidance, a Gradle API decorated for Kotlin, enhanced IntelliJ IDEA integration, lots of DSL polish and bug fixes. At the same time the IntelliJ IDEA Kotlin Plugin fixed important build script editing related issues. It is recommended for everyone to upgrade to the latest and greatest. This release contains potential breaking changes, see below. v1.0-RC6 is included in Gradle...
    :kotlin-flag: 3
    👍 11
    :gradle: 4
    n
    i
    • 2
    • 2
  • i

    irus

    09/14/2018, 1:14 PM
    Is such version definition is ideomatic? https://github.com/Heapy/tgto/blob/master/build.gradle.kts#L10-L26 Maybe there are some more concise way to retrieve versions?
    g
    • 2
    • 2
  • t

    Tobi

    09/14/2018, 2:55 PM
    I am using the following configuration in a
    build.gradle.kts
    with Kotlin 1.2.61 and Gradle wrapper 4.10.1:
    buildscript {
        repositories {
            maven("<https://dl.bintray.com/kotlin/kotlin-dev>")
        }
    }
    
    repositories {
        maven("<https://dl.bintray.com/kotlin/kotlin-dev>")
    }
    
    plugins {
        id("org.gradle.kotlin.kotlin-dsl") version "0.18.3"
    }
    When I try to increase the version of
    kotlin-dsl
    to f.e.
    0.18.4
    or the latest
    0.19.5
    I get the following error:
    Plugin [id: 'org.gradle.kotlin.kotlin-dsl', version: '0.18.4'] was not found in any of the following sources:
    
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (could not resolve plugin artifact 'org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:0.18.4')
      Searched in the following repositories:
        Gradle Central Plugin Repository
    What maven repository is missing here? Or, which combination of Kotlin and kotlin-dsl should work?
    e
    n
    • 3
    • 27
  • i

    ianbrandt

    09/15/2018, 9:23 PM
    Also, is there a Kotlin DSL equivalent for excluding transitive dependencies for a particular configuration? https://docs.gradle.org/current/userguide/managing_transitive_dependencies.html#example_excluding_transitive_dependency_for_a_particular_configuration The migration guide seems to imply it should be possible: https://guides.gradle.org/migrating-build-logic-from-groovy-to-kotlin/#configurations-and-dependencies ...but when I try:
    configurations {
    	testImplementation {
    
    	}
    }
    ...I get:
    Script compilation error:
    
      Line 21: 	testImplementation {
                ^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
                    public inline fun <T : ModuleDependency> DependencyHandler.testImplementation(dependency: TypeVariable(T), dependencyConfiguration: TypeVariable(T).() -> Unit): TypeVariable(T) defined in org.gradle.kotlin.dsl
                    public fun DependencyHandler.testImplementation(dependencyNotation: Any): Dependency? defined in org.gradle.kotlin.dsl
                    public fun DependencyHandler.testImplementation(group: String, name: String, version: String? = ..., configuration: String? = ..., classifier: String? = ..., ext: String? = ...): ExternalModuleDependency defined in org.gradle.kotlin.dsl
                    public inline fun DependencyHandler.testImplementation(group: String, name: String, version: String? = ..., configuration: String? = ..., classifier: String? = ..., ext: String? = ..., dependencyConfiguration: ExternalModuleDependency.() -> Unit): ExternalModuleDependency defined in org.gradle.kotlin.dsl
                    public inline fun DependencyHandler.testImplementation(dependencyNotation: String, dependencyConfiguration: ExternalModuleDependency.() -> Unit): ExternalModuleDependency defined in org.gradle.kotlin.dsl
    
    1 error
    g
    e
    • 3
    • 6
  • v

    Vladyslav Sitalo

    09/16/2018, 2:28 PM
    I have question regarding dependency resolution for plugins. I have the following situation: • A plugin (https://github.com/Stvad/kask-gradle-plugin) that depends on the library I’ve developed - https://github.com/Stvad/kask • The library is build/served by https://jitpack.io. It’s presented as a maven repo -
    maven(url = "<https://jitpack.io>")
    • The plugin is published on the gradle plugin portal. When I’m trying to use the plugin though I’m facing several problems: • If I just use the plugin via
    id("org.stvad.kask") version "0.1.1"
    entry in
    plugins
    section, the project fails initial configuration, with the following error (basically gradle is looking for dependency in the wrong place and not finding it):
    Could not find com.github.Stvad:kask:-SNAPSHOT.
    Searched in the following locations:
      - file:/Users/sitalov/.gradle/caches/4.10/embedded-kotlin-repo-1.2.60-2/repo/com/github/Stvad/kask/-SNAPSHOT/maven-metadata.xml
      - file:/Users/sitalov/.gradle/caches/4.10/embedded-kotlin-repo-1.2.60-2/repo/com/github/Stvad/kask/-SNAPSHOT/kask--SNAPSHOT.jar
      - <https://plugins.gradle.org/m2/com/github/Stvad/kask/-SNAPSHOT/maven-metadata.xml>
      - <https://plugins.gradle.org/m2/com/github/Stvad/kask/-SNAPSHOT/kask--SNAPSHOT.pom>
      - <https://plugins.gradle.org/m2/com/github/Stvad/kask/-SNAPSHOT/kask--SNAPSHOT.jar>
    Required by:
        project : > org.stvad.kask:org.stvad.kask.gradle.plugin:0.1.1 > org.stvad:kask-gradle-plugin:0.1.1
    I can work around that problem by adding the following configuration in the project settings:
    kotlin
    pluginManagement {
        repositories {
            gradlePluginPortal()
            maven(url = "<https://jitpack.io>")
        }
    }
    Which, works, I guess =/, but I’m surprised I have to do this. But after that I have more troubles - my understanding was that plugin dependencies should be transitively available to the project using that plugin. But it does not seem to work for me - in order to make the aforementioned library usable from the project that is applying the plugin, I had to explicitly declare repository and dependency configurations. Which means that to use the plugin properly user would have to: 1) apply it; 2) change plugin repo configuration; 3) add new repo to the project; 4) add explicit library dependency to the project. Which seems rather cumbersome. What I want to achieve is situation when a user of a plugin just needs to apply it and does not have to worry about dependency any dependency declarations. I’d appreciate your advice on how I can achieve that!
    n
    • 2
    • 4
  • e

    eriwen

    09/17/2018, 10:12 PM
    Related: We’d like to help plugin authors provide Kotlin DSL samples. If you’re on this list (https://github.com/gradle/gradle/issues/6790) or want to me, also contact me or Paul on the Gradle team!
    g
    • 2
    • 8
  • g

    gildor

    09/18/2018, 1:18 AM
    @eriwen What about
    <http://plugins.gradle.org|plugins.gradle.org>
    ? Is there any issue about supporting of Kotlin DSL snippets?
    s
    • 2
    • 1
  • c

    cfleming

    09/19/2018, 9:30 AM
    Hi all, I’ve upgraded my build to use 1.2.70, and I have a strange error:
    Caused by: java.lang.ClassNotFoundException: org.gradle.api.attributes.HasAttributes
    a
    • 2
    • 2
  • m

    myanmarking

    09/19/2018, 12:27 PM
    guys, after updating to 1.2.70
    a
    g
    • 3
    • 6
  • u

    Uzi Landsmann

    09/19/2018, 3:45 PM
    Sorry if it's a stupid question, but how can I specify, in my
    build.gradle.kts
    , that I want to target JVM 10?
    g
    c
    • 3
    • 5
  • r

    rpalcolea

    09/20/2018, 8:04 PM
    Hi, does anyone knows the reason / workaround for this issue? -> https://youtrack.jetbrains.net/issue/KT-26834
    Required by:
          project :example-v8
       > Unable to find a matching variant of project :karibu-dsl-v8:
           - Variant 'apiElements':
               - Found org.gradle.usage 'java-api' but wasn't required.
               - Required org.jetbrains.kotlin.platform.type 'common' and found incompatible value 'jvm'.
           - Variant 'runtimeElements':
               - Found org.gradle.usage 'java-runtime-jars' but wasn't required.
               - Required org.jetbrains.kotlin.platform.type 'common' and found incompatible value 'jvm'.
    when using kotlin 1.2.70 and gradle
    g
    h
    f
    • 4
    • 3
  • c

    citizenmatt

    09/25/2018, 7:47 AM
    Does anyone have an example of a real world multi-file Kotlin based gradle build? Especially with using plugins in the non-
    build.gradle.kts
    files? I'm a complete newbie to the Kotlin DSL and struggling with getting plugins to work in a
    foo.gradle.kts
    file, and it would be nice to see how others have done it.
    g
    • 2
    • 13
  • c

    Czar

    09/25/2018, 11:40 AM
    stacktrace_with_1_2_71.txt
    n
    • 2
    • 6
  • n

    Nikky

    09/25/2018, 11:40 AM
    does anyone know where hte gradle docs are for dynamic version declarations ? i found the docs for how dependency locking works: https://docs.gradle.org/4.8/userguide/dependency_locking.html but i have no ideal what other than
    +
    and that range syntax
    [5,)
    is supported by gradle
    n
    • 2
    • 3
  • o

    octylFractal

    09/26/2018, 5:22 AM
    you can provide more strongly-typed
    ext
    variables by adding extension methods that cast the values
    s
    g
    • 3
    • 3
  • s

    spierce7

    09/26/2018, 1:19 PM
    It works if I put them in the
    buildSrc
    folder, but I still have red errors in the IDE. I have to sync the project, and then open the buildSrc file again for the IDE error to disappear. Is that a known issue?
    g
    • 2
    • 5
  • s

    spierce7

    09/26/2018, 2:54 PM
    Actually, I'm finding that I have to duplicate my kotlin version declaration. I have to put it in
    buildSrc
    , but also, the
    buildscript
    block so that I can add the kotlin plugin to the classpath. Is there a way around this?
    g
    • 2
    • 4
  • m

    max

    09/26/2018, 6:47 PM
    Upgraded to stable Android Studio 3.2.0 yesterday, and all my .kts scripts are in red. Tried to clean the caches and restarted AS few times, tried to remove
    .idea
    and all `
    .iml` files and reimport the project, nothing helps. build.gradle.kts files are still all in red. Building is still working properly btw. I saw the answer: https://kotlinlang.slack.com/archives/C19FD9681/p1519224896000437?thread_ts=1519133138.000031&amp;cid=C19FD9681 also saw that this bug in AS is marked as fixed: https://youtrack.jetbrains.com/issue/KT-20521 It just soooo frustrating to work with dsl, just asking for some workaround here, maybe i’m missing some simple tweak?
    g
    • 2
    • 2
  • k

    kingsley

    09/27/2018, 9:39 AM
    For Android, I think you still need to use the buildscript+classpath approach. Settings.gradle.kts + pluginManagement didn’t really work well for me the last time I tried. Debug builds work fine. But building for release always throws an exception. Something about implicit compile/implementation configuration or stuff along that line
    g
    • 2
    • 2
  • r

    ribesg

    09/27/2018, 9:55 AM
    Are you forced to have the
    resolutionStrategy
    block in
    settings.gradle.kts
    ?
    g
    • 2
    • 10
  • r

    ribesg

    09/27/2018, 9:56 AM
    I mean I'm used to having a single include line in there
    g
    • 2
    • 1
Powered by Linen
Title
r

ribesg

09/27/2018, 9:56 AM
I mean I'm used to having a single include line in there
g

gildor

09/27/2018, 9:58 AM
You don’t need buildcript with plugins
View count: 3