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
  • l

    leandro

    11/12/2022, 3:13 PM
    are convention plugins generally recommended over custom logic applied inside
    afterEvaluate {}
    ? I wonder mostly in terms of correctness and performance
    c
    v
    3 replies · 3 participants
  • s

    server

    11/12/2022, 9:45 PM
    I have a plugin based on this template -> https://github.com/bnorm/kotlin-ir-plugin-template performance is terrible, IDE has issues with providing any support. Even auto-complete works very slowly - (if works, most of the time it does not work). to find issues in my code I need to run gradle build (issues like missing imports). After gradle build and some long wait it can find class that is not imported. Any idea what makes this plugin so bad from a performance point of view?
  • b

    Bonsible Hou

    11/14/2022, 3:18 AM
    hey all, I need your help about gradle-build speed, this is build-scan report, I find it not impored after upgrade gradle-7.4.2 & jdk11. or you have more method to impove build speed like okbuck. I have configed according to APG document, it's not good maybe My project is so big. https://scans.gradle.com/s/uvsxvyjhqcwze
    t
    5 replies · 2 participants
  • j

    jean

    11/15/2022, 9:31 PM
    This gradle tasks works correctly, I can see the file at the
    into
    location
    tasks.register<Copy>("copyIosTestResources") {
        from("src/commonTest/resources")
        into("build/bin/iosX64/debugTest/resources")
    }
    
    tasks.findByName("iosX64Test")!!.dependsOn("copyIosTestResources")
    But if I try to do the same for my js target with this
    tasks.register<Copy>("copyJsTestResources") {
        from("src/commonTest/resources")
        into("build/js/test/resources")
    }
    
    tasks.findByName("jsTest")!!.dependsOn("copyJsTestResources")
    I tried a bunch of different values for
    into
    but it doesn’t seem to work at all. Any idea why?
    j
    v
    +1
    11 replies · 4 participants
  • d

    dave08

    11/17/2022, 12:46 PM
    How could I run the test tasks in all the subprojects hierarchy from the root project (preferrably in a way Intellij could display the results...)?
    e
    s
    +1
    4 replies · 4 participants
  • d

    dave08

    11/17/2022, 12:50 PM
    For some reason it seems to run the tests for only one of the many submodules...:
    // in the root build.gradle.kts:
    tasks.named<Test>("test") {
        useJUnitPlatform()
        testLogging {
            showExceptions = true
            showStandardStreams = true
            exceptionFormat = FULL
        }
    }
    v
    1 reply · 2 participants
  • h

    hfhbd

    11/17/2022, 2:30 PM
    How can you add additional dependencies depending on the configuration at the configuration stage with included and substituted modules? Use-case: I want to support configuration cache for licensee. Licensee resolves the dependency pom files and checks its license, so it needs to add a
    pom
    dependency for each dependency, transitively. At the moment, this is done in the task action, so the pom dependency is added during the task action, but this breaks the configuration cache. I moved the additional pom file dependency to the configuration stage, but now I have a problem with module substitution:
    Adding a dependency substitution rule to a configuration changes the timing of when that configuration is resolved.
    Is there any workaround possible? https://github.com/cashapp/licensee/pull/141
  • e

    escodro

    11/17/2022, 8:29 PM
    Hey! I’m trying to apply the Compose Rules plugin to my project, but I’m having some issues. Both my detekt and ktlint configurations are precompiled Gradle scripts in KTS. How could I add a plugin here?
    // detekt.gradle.kts
    apply<DetektPlugin>()
    
    configure<DetektExtension> {
        config = files("$rootDir/config/filters/detekt.yml")
        allRules = true
    }
    
    tasks.withType<Detekt>().configureEach {
        exclude("**/resources/**,**/build/**")
    }
    j
    4 replies · 2 participants
  • b

    Bonsible Hou

    11/18/2022, 12:58 PM
    Hey! Our Android Project build make some log about R8. Maybe you have meet it(print many times and long time ). need your help to solve it or improve Our project.
    WARNING:/Users/alger/.jenkins/object_android_apk_pack_gradle7/VeSync_RN/android/app/build/intermediates/transforms/sensorsAnalyticsAutoTrack/check/releaseStaging/57.jar: R8: Expected stack map table for method with non-linear control flow. In later version of R8, the method may be assumed not reachable.
    v
    2 replies · 2 participants
  • p

    Pavel Meledin

    11/20/2022, 11:32 AM
    Hey! Adding
    testImplementation
    dependency on
    Gradle API
    triggers a conflict of loggers and blocks further work, since
    SLF4J: Class path contains multiple SLF4J bindings.
    Is it possible to “cut off” the gradle logger so it won’t be on the classpath? Some context related details: • It’s added just as a dependency
    testImplementation(gradleApi())
    • The goal of adding Gradle API is for enabling an ability to run some custom gradle tasks during integration/end-to-end testing (I’m using JUnit) • It doesn’t seem possible to exclude the logger as it’s built-in into the Gradle source, so it seems not even a dedicated module that could be possible to just exclude from the build 🤷‍♂️ an error messages:
    SLF4J: Class path contains multiple SLF4J bindings.
    SLF4J: Found binding in [jar:file:$HOME/.gradle/caches/7.5/generated-gradle-jars/gradle-api-7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: Found binding in [jar:file:$HOME/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.11/4741689214e9d1e8408b206506cbe76d1c6a7d60/logback-classic-1.2.11.jar!/org/slf4j/impl/StaticLoggerBinder.class]
    SLF4J: See <http://www.slf4j.org/codes.html#multiple_bindings> for an explanation.
    SLF4J: Actual binding is of type [org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext]
    ...
    Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext loaded from file:$HOME/.gradle/caches/7.5/generated-gradle-jars/gradle-api-7.5.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.gradle.internal.logging.slf4j.OutputEventListenerBackedLoggerContext
    ...
    Please suggest what are the options to resolve this conflict which 🙏
    v
    2 replies · 2 participants
  • j

    janvladimirmostert

    11/20/2022, 3:47 PM
    gradle build -t
    allows you to always automatically build when you make changes is there a way to automatically restart an application after a rebuild? I was trying
    gradle run -t
    which is running the application, but it doesn't rebuild and restart when making changes.
    h
    b
    7 replies · 3 participants
  • c

    Carl Benson

    11/22/2022, 9:49 AM
    hi, I'm trying to follow the Gradle guide for writing a custom plugin as a standalone project as described here https://docs.gradle.org/current/userguide/implementing_gradle_plugins.html#plugin-development-plugin code in thread
    v
    r
    8 replies · 3 participants
  • j

    Javier

    11/23/2022, 1:17 PM
    Anyone seeing this warning?
    e: java.rmi.ServerError: Error occurred in server thread; nested exception is:
            java.lang.NoClassDefFoundError: org/jetbrains/kotlin/daemon/common/CompileService$CallResult$Dying
    Could not perform incremental compilation: Could not connect to Kotlin compile daemon
    Could not connect to kotlin daemon. Using fallback strategy.
    t
    6 replies · 2 participants
  • h

    huehnerlady

    11/23/2022, 4:14 PM
    Hi, anybody fit in gradle init scripts (init.gradle.kts)? I want to enable the kotlin compiler setting
    allWarningsAsErrors
    I do not want that in general, just on my local machine (as this would also fire when there are deprecations) Currently my file includes:
    allprojects {
    
      afterEvaluate {
        if (tasks.findByName("compileKotlin") == null) {
          logger.lifecycle("[init.gradle.kts] no kotlin project")
        }
        else {
          logger.lifecycle("[init.gradle.kts] adding 'allWarningsAsErrors = true'")
          tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
            kotlinOptions {
              allWarningsAsErrors = true
            }
          }
        }
      }
    }
    When I run my project it is showing the
    [init.gradle.kts] adding 'allWarningsAsErrors = true'
    log message, but the warnings do not make the build fail. if I add that flag to the build script, it does fail. Any idea what I am doing wrong?
    v
    12 replies · 2 participants
  • d

    David Rawson

    11/25/2022, 3:53 AM
    The Gradle build cache docs recommend only pushing to the remote build cache on CI server builds. Is it desirable to restrict this further to builds of the trunk branch only? Or would it be okay to enable CI server remote build cache pushes for PR branches that have not yet been merged into the trunk branch?
    v
    1 reply · 2 participants
  • m

    mudasar187

    11/25/2022, 12:32 PM
    Hi! This is my gradle settings. But when i run
    ./gradlew shadowJar
    , it appears two jars files. One named app.jar and another named sokos-ktor-template.jar. Why do i get two jars ?
    import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
    import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
    import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
    import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
    
    val ktorVersion = "2.1.3"
    val junitJupiterVersion = "5.9.1"
    val logbackVersion = "1.4.4"
    val logstashVersion = "7.2"
    val jacksonVersion = "2.14.0"
    val prometheusVersion = "1.10.0"
    val kotlinLoggingVersion = "3.0.4"
    
    plugins {
        kotlin("jvm") version "1.7.21"
        kotlin("plugin.serialization") version "1.7.21"
        id("org.openapi.generator") version "6.2.1"
        id("com.github.johnrengelman.shadow") version "7.1.2"
    }
    
    group = "no.nav.sokos.prosjektnavn"
    java.sourceCompatibility = JavaVersion.VERSION_17
    
    repositories {
        mavenCentral()
        maven { url = uri("<https://maven.pkg.jetbrains.space/public/p/ktor/eap>") }
    }
    
    dependencies {
    
        // Ktor
        implementation("io.ktor:ktor-server-core-jvm:$ktorVersion")
        implementation("io.ktor:ktor-server-netty-jvm:$ktorVersion")
        implementation("io.ktor:ktor-client-apache:$ktorVersion")
        implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion")
        implementation("io.ktor:ktor-server-metrics-micrometer:$ktorVersion")
        implementation("io.ktor:ktor-server:$ktorVersion")
        implementation("io.ktor:ktor-server-status-pages:$ktorVersion")
    
        // Jackson
        implementation("io.ktor:ktor-serialization-jackson:$ktorVersion")
        implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
        implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
        implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion")
    
        // Monitorering
        implementation("io.micrometer:micrometer-registry-prometheus:$prometheusVersion")
    
        // Logging
        implementation("ch.qos.logback:logback-core:$logbackVersion")
        implementation("ch.qos.logback:logback-classic:$logbackVersion")
        implementation("net.logstash.logback:logstash-logback-encoder:$logstashVersion")
        implementation("io.github.microutils:kotlin-logging-jvm:$kotlinLoggingVersion")
    
        // Test
        testImplementation("io.ktor:ktor-server-tests-jvm:$ktorVersion")
        testImplementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
        testImplementation("org.junit.jupiter:junit-jupiter-params:$junitJupiterVersion")
        testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
    }
    
    sourceSets {
        main {
            java {
                srcDirs("$buildDir/generated/src/main/kotlin")
            }
        }
    }
    
    tasks.named<GenerateTask>("openApiGenerate") {
        generatorName.set("kotlin")
        generateModelDocumentation.set(false)
        inputSpec.set("$rootDir/specs/pets.json")
        outputDir.set("$buildDir/generated")
        globalProperties.set(
            mapOf(
                "models" to ""
            )
        )
        configOptions.set(
            mapOf(
                "library" to "jvm-ktor",
                "serializationLibrary" to "jackson"
            )
        )
    }
    
    tasks.named<ShadowJar>("shadowJar") {
        archiveFileName.set("app.jar")
        manifest {
            attributes["Main-Class"] = "no.nav.sokos.prosjektnavn.BootstrapKt"
        }
    }
    
    tasks.withType<KotlinCompile> {
        dependsOn("openApiGenerate")
        kotlinOptions.jvmTarget = "17"
    }
    
    tasks.withType<Test> {
        useJUnitPlatform()
        testLogging {
            exceptionFormat = FULL
            events("passed", "skipped", "failed")
        }
    
        // For å øke hastigheten på build kan vi benytte disse metodene
        maxParallelForks = Runtime.getRuntime().availableProcessors() / 2
        reports.forEach { report -> report.required.value(false) }
    }
    t
    c
    5 replies · 3 participants
  • a

    Ayfri

    11/25/2022, 4:25 PM
    Hi, for a project, I need to download some JSONs and generate Kotlin code from these JSONs before building the project, or just at some time using a gradle task, how can I achieve this ? (It's for generating an enum containing all the blocks of Minecraft for a project that I own that let's you generate Minecraft Java DataPacks from Kotlin code, the enum will be there to have better typings when targeting a block instead of just a String)
    v
    m
    +1
    26 replies · 4 participants
  • p

    Piotr Krzemiński

    11/25/2022, 10:29 PM
    Anyone affected by upgrading to Gradle 7.6? I'm getting this
    Multiple incompatible variants
    error: https://pastebin.com/t3tx8SCy. See the PR to reproduce: https://github.com/krzema12/github-workflows-kt/pull/569
    j
    c
    +1
    4 replies · 4 participants
  • g

    Gabi

    11/26/2022, 1:23 AM
    Hi! I'm struggling with this error: https://gist.github.com/gabrielleeg1/4368e838f75d1333f7da962abef32933 And the build script for the
    buildSrc
    file is simply:
    plugins {
        `kotlin-dsl`
    }
    
    repositories {
        maven("<https://plugins.gradle.org/m2/>")
        mavenCentral()
    }
    Can anyone help me?
    e
    5 replies · 2 participants
  • k

    Karthick

    11/26/2022, 3:10 AM
    [Edit] ✅ resolved. hello folks, Running into issues with Gradle config..
    Required by:
        project : > org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.7.21 > org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.21
    Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.7.21.
    Caused by: org.gradle.api.resources.ResourceException: Could not get resource '<https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-scripting-compiler-impl-embeddable/1.7.21/kotlin-scripting-compiler-impl-embeddable-1.7.21.pom>'.
    Cert validation is failing for
    Caused by: org.gradle.api.resources.ResourceException: Could not get resource '<https://plugins.gradle.org/m2/org/jetbrains/kotlin/kotlin-scripting-compiler-impl-embeddable/1.7.21/kotlin-scripting-compiler-impl-embeddable-1.7.21.pom>'.
    Caused by: org.gradle.internal.resource.transport.http.HttpRequestException: Could not GET '<https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-scripting-compiler-impl-embeddable/1.7.21/kotlin-scripting-compiler-impl-embeddable-1.7.21.pom>'.
    my config
    ➜  ~ java -version
    openjdk version "17.0.5" 2022-10-18
    OpenJDK Runtime Environment Homebrew (build 17.0.5+0)
    OpenJDK 64-Bit Server VM Homebrew (build 17.0.5+0, mixed mode, sharing)
    ➜  ~ gradle -v
    
    ------------------------------------------------------------
    Gradle 7.6
    ------------------------------------------------------------
    
    Build time:   2022-11-25 13:35:10 UTC
    Revision:     daece9dbc5b79370cc8e4fd6fe4b2cd400e150a8
    
    Kotlin:       1.7.10
    Groovy:       3.0.13
    Ant:          Apache Ant(TM) version 1.10.11 compiled on July 10 2021
    JVM:          17.0.5 (Homebrew 17.0.5+0)
    OS:           Mac OS X 12.6.1 aarch64
    
    ➜  ~
    I am using
    IntelliJ IDEA 2022.2.4 (Community Edition)
    Is anyone facing this issue?
    c
    2 replies · 2 participants
  • e

    Emil Kantis

    11/26/2022, 2:02 PM
    Kotest builds with Gradle 7.6 are failing. Anyone seen this problem already? https://github.com/kotest/kotest/pull/3302
    * What went wrong:
    A problem occurred configuring project ':kotest-framework:kotest-framework-multiplatform-plugin-gradle'.
    > Failed to notify project evaluation listener.
       > org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin: Provider org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverGradleSubplugin not a subtype
       > org.jetbrains.kotlin.gradle.plugin.KotlinGradleSubplugin: Provider org.jetbrains.kotlin.samWithReceiver.gradle.SamWithReceiverGradleSubplugin not a subtype
    e
    a
    +1
    5 replies · 4 participants
  • s

    Shabinder Singh

    11/26/2022, 10:08 PM
    This builds just fine ✅ and IDE references as well ✅, but crashes at runtime ❌ any help will be appreciated ?
  • a

    Adam S

    11/27/2022, 10:20 AM
    How can I enable explicit API mode in Kotlin Multiplatform, using the Gradle DSL?
    3 replies · 1 participant
  • t

    tapchicoma

    11/28/2022, 9:49 AM
    Those who see variant selection issue on using KotlinGradlePlugin +
    kotlin-dsl
    plugins after updating to Gradle 7.6 should also add
    id("org.jetbrains.kotlin.plugin.sam.with.receiver") version "<kotlin_version>"
    into
    plugins { .. }
    block. Related issue that should be fixed in Kotlin 1.8.20 release.
  • t

    Tianyu Zhu

    11/29/2022, 9:59 PM
    Hi! For my java projects I can write the following in my Gradle file:
    java.targetCompatibility = JavaVersion.1_8
    Is there a similar way I can set the
    jvmTarget
    for my Kotlin code?
    c
    e
    +1
    9 replies · 4 participants
  • c

    Carter

    11/30/2022, 11:52 AM
    I’m trying to update a Kotlin multiplatform project to Kotlin 1.7.21, and I’m hitting a failure that I’m including in a thread. The project is using Gradle 7.6. I use kts for my build scripts, and I have some build conventions set up. Because the build conventions are for the Kotlin multiplatform Gradle plugin, I do include the Kotlin 1.7.21 plugin in the build convention dependencies. The last thing I have is dependency locking enabled. The build failure happens when I trigger a build on GitHub Actions, but I can’t trigger the same failure locally on my Mac. I realize that’s a lot of variables, but I suspect the combination of dependency locking and including Kotlin 1.7.21 for the build convention ends up causing the failure. If I disable dependency locking, the issue goes away. I’m glad to file a YouTrack issue, but I’m having trouble narrowing this down further. Thoughts on anything else I can try?
    t
    c
    +1
    18 replies · 4 participants
  • e

    eygraber

    12/04/2022, 9:17 PM
    If I setup a toolchain the following way, should Gradle automatically download a matching jdk if it can't find one already on the system:
    jvmToolchain {
          languageVersion.set(JavaLanguageVersion.of(libs.versions.jdk.get()))
          vendor.set(JvmVendorSpec.AZUL)
    }
    v
    g
    +1
    12 replies · 4 participants
  • a

    Amanda Martin

    12/05/2022, 4:11 PM
    Gradle is hosting a free Kotlin DSL Gradle webinar. It is a get intro to Kotlin with Gradle, our first time running such a training. Let me know if you have questions!
  • j

    joney

    12/07/2022, 2:58 PM
    Is it possible to use context receivers with kotlin-dsl in gradle scripts? I saw that gradle 7.6 updated embedded kotlin to 1.7.10, but I still can’t use context receivers in gradle scripts:
    java.lang.UnsupportedOperationException: Unsupported receiver value: Cxt { context(org.gradle.api.Project) [...]
    c
    v
    +1
    9 replies · 4 participants
  • f

    FunkyMuse

    12/08/2022, 3:46 PM
    Why Is it impossible to use json in Gradle from 8.0 onwards? I have some .kts scripts where I read some local files that are JSONs
    c
    a
    5 replies · 3 participants
Powered by Linen
Title
f

FunkyMuse

12/08/2022, 3:46 PM
Why Is it impossible to use json in Gradle from 8.0 onwards? I have some .kts scripts where I read some local files that are JSONs
c

Chris Lee

12/08/2022, 4:00 PM
Is there a specific error message or limitation you are referencing?
f

FunkyMuse

12/08/2022, 6:04 PM
Limitation, JSON can’t be used in Gradle KTS probably groovy too 🤔
org.json.simple.*
isn’t available
c

Chris Lee

12/08/2022, 6:05 PM
that’s a 3rd party library, not part of Gradle. Import the library as required to use it.
a

Adam S

12/08/2022, 6:14 PM
I’ve got a Gradle 7.6 project, and I can’t import
org.json.simple.*
, so this isn’t particular to Gradle 8. My guess is that you used to have a Gradle plugin that had a dependency on org.json, but you haven’t applied the plugin, or the plugin has been updated to remove that dependency. If you want to add the JSON library back, you can either do it in
./buildSrc/build.gradle.kts
, or as a buildscript dependency. Alternatively, Groovy can process JSON
f

FunkyMuse

12/08/2022, 6:30 PM
Thanks guys!
View count: 10