https://kotlinlang.org logo
Docs
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
  • a

    allan.conda

    10/18/2021, 5:11 AM
    👋 Anyone know where I could find release notes for Gradle Kotlin DSL updates?
    m
    n
    • 3
    • 2
  • u

    ursus

    10/18/2021, 10:32 AM
    Is it just me, but ever since some version of gradle, whenever my code wont compile, I see the FAILED task, but build keeps going compiling probably until all work is done? Why? Its sometimes 10s of seconds wasted
    > Task :clean
    > Task :android-test-utils:clean
    > Task :base-moshi:clean
    > Task :base-di:clean FAILED
    > Task :base-android:clean
    > Task :base:clean
    > Task :base-conductor:clean
    > Task :base-coil:clean
    > Task :auto-initialized-compiler:clean
    > Task :base-net:clean
    > Task :base-sqldelight:clean
    > Task :auto-initialized-compiler:clean FAILED
    > Task :global:clean
    > Task :crashlytics:clean
    > Task :base:clean FAILED
    > Task :test-utils:clean
    > Task :hashes:clean
    > Task :regex:clean
    > Task :formatter:clean
    > Task :triggers-test-utils:clean
    > Task :sqldelight-android-driver:clean
    > Task :timestamp-parser:clean
    > Task :usage-units:clean
    > Task :activity-ui-helper:contract:clean
    > Task :analytics:test-utils:clean
    > Task :analytics:contract:clean
    > Task :approvals:contract:clean
    > Task :approvals:impl:clean
    > Task :auth:test-utils:clean
    > Task :analytics:exponea-tracker:clean
    > Task :analytics:impl:clean
    > Task :activity-ui-helper:impl:clean
    > Task :payments-ui:clean
    > Task :auth-flow:contract:clean
    > Task :auth:contract:clean
    > Task :auth:impl:clean
    > Task :card-registration:contract:clean
    > Task :chat:contract:clean
    > Task :card-registration:impl:clean
    > Task :auth-flow:impl:clean
    > Task :chat:impl:clean
    > Task :complex-syncer:test-utils:clean
    > Task :config:config-api:clean
    > Task :config:test-utils:clean
    > Task :config:contract:clean
    > Task :contacts:contract:clean
    > Task :contacts:test-utils:clean
    > Task :device-metadata:test-utils:clean
    > Task :device-metadata:contract:clean
    > Task :contacts:impl:clean
    > Task :device-metadata:impl:clean
    > Task :gdpr:impl:clean
    > Task :gdpr:contract:clean
    > Task :config:impl:clean
    > Task :complex-syncer:contract:clean
    > Task :in-app-review:contract:clean
    ....
    and keeps going for 5minutes only to then print out red text that base-di:clean failed -- also, why on earth does clean fail is beyond me as well
    v
    z
    d
    • 4
    • 30
  • s

    Strum355

    10/18/2021, 11:43 AM
    Is it possible to configure
    KotlinCompile
    tasks in init scripts? Im trying to do
    tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile(.class)?)
    (with and without .class) but the fqn never seems to resolve
    • 1
    • 1
  • a

    ankushg

    10/18/2021, 9:12 PM
    I'm noticing that quite a few useful Kotlin compiler arguments exist that haven't yet made their way into the Gradle DSL. As a result, we have a lot of things split between
    freeCompilerArgs
    vs
    kotlinOptions
    Is there a philosophy on which CLI args should be configurable via gradle properties vs which ones shouldn't? Are there docs on which flags are more experimental than others? I initially assumed that maybe only stable things make it into the Gradle DSL, but I'm also seeing a few experimental things available in there too (e.g.,
    KotlinCommonOptions.useFir
    ) I mostly want to avoid spamming youtrack tickets or PRs for every little CLI arg if there's a process that's being followed that I just don't know about 😅
    ❤️ 2
    👍 2
    g
    t
    m
    • 4
    • 8
  • p

    Philip Dukhov

    10/22/2021, 3:14 PM
    I need to add a dependency from an other local project. I've followed this SO answer
    include(":module-name")
    project(":module-name").projectDir = File("../../project-dir/")
    But I'm getting an error about unrecognized class from
    buildSrc
    folder of
    OtherProject
    , from other project
    gradle.build
    file. Itself
    OtherProject
    builds fine. Do I need to add
    buildSrc
    explicitly somehow? Edit. I've tried
    includeBuild
    as @Vampire suggested, but it doesn't seems working with my KMM module. I'm using this code:
    includeBuild("../../project-dir/") {
        dependencySubstitution {
            substitute(module("com.project:module-name"))
                .with(project(":module-name"))
        }
    }
    Which produces the following error
    ArtifactNotFoundException: Could not find kotlinx-coroutines-core-1.5.1-native-mt-samplessources.jar
    v
    j
    l
    • 4
    • 5
  • e

    Egons Zile

    10/22/2021, 3:45 PM
    Hello, can anyone point me to documentation on how can I create something similar to flavours, but in pure Kotlin library, so NOT Android? Thanks
    e
    • 2
    • 4
  • j

    Jeff Lockhart

    10/22/2021, 8:26 PM
    I have an existing KMM shared module in my Android app I'm trying to add locally to test in another JVM/JS KMP project. In my settings.gradle.kts I added:
    include(":shared")
    project(":shared").projectDir = File("../path-to-android-project/shared")
    And added
    implementation(project(":shared"))
    to the commonMain dependencies. But I'm getting weird behavior now. The project UI on the left shows two copies of the project, one as a "module" (single blue square icon) appears as before without the shared module beneath. But a second "module group" (4 blue squares icon) appears as well with the shared module beneath. When I attempt to build the project, I get the error:
    Could not resolve project :shared.
    Required by:
    project :app
    How can I successfully add a module like this to the project?
    v
    • 2
    • 2
  • n

    nilTheDev

    10/25/2021, 7:50 AM
    I am reading a book on Gradle, little bit old from 2012 or something like that. There is a
    <<
    syntax I encountered which is an alternative of
    doLast
    . Here is a snippet,
    3.times {
     task "yayGradle$it" << { 
     println 'Gradle rocks'
     }
    }
    but it isn't working. I anticipate the syntax my have been deprecated. Can anyone point out which version I can use to run that snippet?
    j
    g
    +2
    • 5
    • 17
  • u

    ursus

    10/28/2021, 1:05 AM
    Hey, I watched a agp video and they mention gradle project isolation, as means to improve sync times -- what sync times? I thought syncing was IDE thing .. is gradle aware of IDE?
    d
    a
    +2
    • 5
    • 6
  • s

    Sylvain Patenaude

    10/28/2021, 1:41 PM
    Why do I see
    iosSimTest
    but not
    iosTest
    in my project gradle tasks? Did that task use to be there or am I crazy?
    • 1
    • 3
  • m

    mbonnin

    10/28/2021, 3:26 PM
    What is the current situation regarding Maven publishing with the Kotlin plugin? My current understanding is that: •
    org.jetbrains.kotlin.jvm
    doesn't create any publication and leaves that to the user •
    org.jetbrains.kotlin.multiplatform
    does This feels somewhat inconsistent. Are there any plans to configure publication automatically when using the JVM plugin?
    ➕ 2
    j
    t
    g
    • 4
    • 4
  • l

    LastExceed

    10/28/2021, 6:16 PM
    im trying out code generation, this is what i have rn:
    val generateSources by tasks.creating {
    	outputs.dir("build/generated/")
    	doLast {
    		File(
    			outputs.files.single(),
    			"generated.kt"
    		).writeText("""fun foo() = println("hello from generated code")""")
    	}
    }
    sourceSets["main"].java.srcDir(generateSources.outputs.files)
    it works, but it requires me to put the code generation logic inside
    build.gradle
    . how do move it into a subproject ?
    e
    • 2
    • 2
  • m

    mbonnin

    10/29/2021, 9:46 AM
    How do I tranform a
    project.getKotlinPluginVersion: String
    into a
    KotlinVersion(Int, Int,Int)
    ?
    b
    t
    a
    • 4
    • 30
  • t

    Tomasz Krakowiak

    10/29/2021, 10:18 AM
    Is it possible to pass custom program arguments to default nodeDevelopmentRun task?
    t
    a
    • 3
    • 3
  • n

    natario1

    10/30/2021, 9:35 PM
    What does
    KotlinCompilation.associateWith
    do?
    z
    • 2
    • 2
  • s

    Slackbot

    10/31/2021, 12:08 PM
    This message was deleted.
    :not-kotlin: 1
    z
    • 2
    • 1
  • z

    Zac Sweers

    11/01/2021, 8:01 PM
    waiting for gradle 7.3
    ☝️ 2
    n
    v
    t
    • 4
    • 6
  • e

    Endre Deak

    11/01/2021, 8:48 PM
    Looking for some advice / best practice here: I use gradle locally, but we do have a custom build script which builds a docker image and executes gradle commands there. Now, locally it seems convenient to increase gradle memory via
    -Xmx4096m
    but when I do the build in Docker then I don’t need this amount of memory. What’s the right way to tell my local gradle to use that amount of memory outside of my
    gradle,properties
    file in my project? I use IntelliJ IDEA and command line too, so ideally when I kick off a gradle command via the IDE or just type
    gradle command
    , the same settings would be picked up, but when it runs within the docker image, then it just ignores it.
    e
    f
    • 3
    • 3
  • g

    groostav

    11/05/2021, 7:27 PM
    urgh:
    error in project :B
    Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
    I have a ~simple gradle.build.kts with two projects (:A and :B, where B depends on A with a
    deps{compile(project(":A"))}
    ), and about 20 runtime deps. 1. under intelliJ i can verify that the output class files from
    :A
    are in java 11 (bytecode v55) 2. when i omit my problem section and compile
    :B
    without it, I get java 11 (bytecode v55) classes I'm using
    tasks.compileJava {
        options.release.set(11)
        sourceCompatibility = "11"
        targetCompatibility = "11"
    }
    tasks.compileKotlin {
        kotlinOptions.jvmTarget = "11"
        sourceCompatibility = "11"
    }
    everywhere I can think. help?
    e
    t
    • 3
    • 32
  • s

    Su5eD

    11/06/2021, 11:15 AM
    Hello, is it possible to ship relocated kotlin libraries with the shadowJar plugin? Currently I'm having an issue with
    kotlin_builtins
    classes not being found
    m
    e
    • 3
    • 15
  • s

    Shabinder Singh

    11/07/2021, 6:57 AM
    I am not able to figure out from where this module is being imported and how to remove it ?
    v
    e
    • 3
    • 4
  • s

    Shabinder Singh

    11/07/2021, 7:11 AM
    As whenever I launch any build/assemble task, It spawns two tasks: one correct and one which fails as it picks my RootDIR as linux $HOME
    v
    • 2
    • 6
  • u

    ursus

    11/07/2021, 10:59 PM
    Can I reference the :notifications:contract module as dependency in the :impl somehow relatively? this is a pattern in my project, and the impl always depends on contract, and its annoying to always use the full name is there a way I could to
    implementation project("..contract")
    or something like that?
    v
    • 2
    • 2
  • m

    Miquel Àngel Román

    11/08/2021, 8:55 AM
    I made a question on stack overflow yesterday on how to run a command after a certain gradle task is killed? (https://stackoverflow.com/q/69877187/9248718)
    p
    h
    n
    • 4
    • 9
  • p

    Piotr Krzemiński

    11/09/2021, 1:00 PM
    anyone facing this? on Gradle 7.1:
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    A problem occurred configuring project ':buildSrc'.
    > Could not resolve all artifacts for configuration ':buildSrc:classpath'.
       > Could not resolve org.gradle.kotlin:gradle-kotlin-dsl-plugins:2.1.4.
         Required by:
             project :buildSrc > org.gradle.kotlin.kotlin-dsl:org.gradle.kotlin.kotlin-dsl.gradle.plugin:2.1.4
          > Could not resolve org.gradle.kotlin:gradle-kotlin-dsl-plugins:2.1.4.
             > Could not get resource '<https://plugins.gradle.org/m2/org/gradle/kotlin/gradle-kotlin-dsl-plugins/2.1.4/gradle-kotlin-dsl-plugins-2.1.4.module>'.
                > Could not GET '<https://jcenter.bintray.com/org/gradle/kotlin/gradle-kotlin-dsl-plugins/2.1.4/gradle-kotlin-dsl-plugins-2.1.4.module>'.
                   > PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed
    on Gradle 7.2 - a bunch of these:
    > Could not resolve all artifacts for configuration ':buildSrc:classpath'.
       > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21.
         Required by:
             project :buildSrc
          > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21.
             > Could not get resource '<https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.5.21/kotlin-stdlib-jdk8-1.5.21.pom>'.
                > Could not HEAD '<https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.5.21/kotlin-stdlib-jdk8-1.5.21.pom>'.
                   > PKIX path validation failed: java.security.cert.CertPathValidatorException: validity check failed
       > Could not resolve org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21.
    Bintray was deprecated, right?
    :also-yes: 1
    t
    k
    +3
    • 6
    • 27
  • i

    ipolyzos

    11/09/2021, 3:26 PM
    coming to gradle after maven and sbt wondering if there is a collection of recommended resources (latest up to date) to get up to speed with gradle and kotlin dsl
    t
    v
    • 3
    • 5
  • o

    Oleh

    11/09/2021, 5:25 PM
    Hello! I am working on an Android project with multiple modules. To reduce boilerplate Gradle configuration, I have created a custom plugin that I apply to all modules. I have put it in the buildSrc directory. Also, we keep our dependencies in the .kt file under the buildSrc directory. To access classes from the plugin, I have to move the plugin dependency from classpath declaration inside root build.gradle.kts file to implementation section in buildSrc/build.gradle.kts file. The problem is that I want to have versions for build plugins and runtime dependencies in the same place. I cannot access my Dependencies.kt file from buildSrc/build.gradle.kt file. I have tried to move plugin implementation to a separate module but had no success. Also, I tried to define the version in extra or project properties, but I can’t access them from the .kt file.
    v
    • 2
    • 4
  • m

    MBegemot

    11/10/2021, 4:17 PM
    I'm getting this error since gradle 7.2: No model of type 'TurnOffDefaultTasks' is available in this build. This on a multibuild project with include builds in android
    v
    c
    • 3
    • 3
  • e

    eygraber

    11/10/2021, 7:24 PM
    I've started seeing the following get printed when running gradle tasks from the command line:
    > Task :buildSrc:compileKotlin
    'compileJava' task (current target is 11) and 'compileKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
    My buildSrc
    build.gradle.kts
    is in 🧵 and I believe I'm setting all of the Java and Kotlin targets correctly.
    t
    p
    • 3
    • 11
  • a

    Ansh Tyagi

    11/11/2021, 9:09 AM
    while running
    ./gradlew run
    the program doesnt wait for the input. I want to take in input from the stdin, hence i am using readLine(). Do we have to specify some args in build.gradle.kts?
    v
    • 2
    • 1
Powered by Linen
Title
a

Ansh Tyagi

11/11/2021, 9:09 AM
while running
./gradlew run
the program doesnt wait for the input. I want to take in input from the stdin, hence i am using readLine(). Do we have to specify some args in build.gradle.kts?
v

Vampire

11/11/2021, 9:40 AM
Yes,
run
is a
JavaExec
typed task.
JavaExec
has a property
standardInput
which by default as documented is set to an empty stream. Set it to
<http://System.in|System.in>
and it should work.
👍 2
:thank-you: 1
👏 2
View count: 5