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

    AB

    01/22/2021, 2:28 PM
    hey guys I am getting an error as unresolved reference when I type
    import com.github.kittinunf.fuel.httpGet
    the dependency is already in my gradle build file sorry if this seems a noobish question, but it's my first time to deal with JVM ecosystem
    v
    • 2
    • 1
  • i

    Imany

    01/23/2021, 11:58 AM
    Hello How can I include
    some-gradle.properties
    into main
    gradle.properties
    and get variables defined in it from
    settings.gradle.kts
    or
    build.gradle.kts
    ?
    m
    e
    • 3
    • 7
  • s

    samuel

    01/23/2021, 11:06 PM
    Hi, i’m looking to have some conditional logic checks in my
    settings.gradle
    that i’d like to use to short circuit the build during the initialization stage. Currently this is what i have
    gradle.settingsEvaluated {
        if (failConditionIsTrue) {
            throw GradleException("Helpful message explaining the cause of the error")
        }
    }
    Is there a better way to do this? possibly throw the exception as a first step in the initialization phase?
    v
    • 2
    • 6
  • d

    dMusicb

    01/26/2021, 3:13 AM
    Instead of duplicating the same properties into multiple tasks, is there a way to extract them out into a method/fn and apply to each task with just a function call or apply or something?
    v
    n
    • 3
    • 2
  • m

    magnumrocha

    01/28/2021, 7:16 PM
    does anyone having problem after update Android Studio Arctic Fox Canary 5 (2020.3.1.5) ?
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    lateinit property variantName has not been initialized
    My setup: Android Studio Arctic Fox Canary 5 (2020.3.1.5) Android Gradle Plugin 7.0.0-alpha05 Gradle 6.8.1
    ➕ 2
    d
    p
    • 3
    • 2
  • e

    Eivind

    01/29/2021, 7:16 AM
    Hi what's the correct way of applying a plugg in to all projects that has another pluggin. 'pmd' pluggin to all that has 'java'. Currently trying in the allprojects block of my root gradle file.
    j
    • 2
    • 2
  • w

    WukongRework.exe

    01/31/2021, 6:38 AM
    Im trying to update my kotlin to 1.4.20 and doing
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
    when kotlin_version = 1.4.0 build succeeds but when kotlin_version is 1.4.20 it fails, i am using kotlin jvm plugin version 1.4.20. Any help would be appreciated!
    m
    g
    • 3
    • 11
  • s

    Slackbot

    01/31/2021, 7:05 PM
    This message was deleted.
    e
    • 2
    • 1
  • w

    WukongRework.exe

    02/01/2021, 12:40 AM
    After fixing my previous error of not being able to add the dependency of kotlin stdlib jdk8 by changing the jdk used by my project structure to the jetbrains openjdk 15 and not my own install of openjdk8, basic stdlib functions such as println and print are now marked as unresolved references in kotlin files even though when i press run, it all builds correctly. I tried an invalidate and restart and this still didn't change. Any way to fix? (also sorry if this is the incorrect place to post this, but this only happened in attempts to change my build.gradle files so if there is a better place to post this please let me know) Thanks in advance!
    • 1
    • 3
  • t

    Timo Gruen

    02/01/2021, 4:42 PM
    I’m currently running into the following issue: Right before the issue came up for the first time, i added new Aspects to my
    buildSrc/src/main/kotlin/example.kotlin-convention.gradle.kts
    import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
    
    plugins {
        kotlin("jvm")
        id("example.java-conventions")
    }
    
    dependencies {
        testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
        testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
    }
    
    tasks.withType<KotlinCompile> {
        kotlinOptions {
            freeCompilerArgs = listOf("-Xjsr305=strict")
            jvmTarget = "1.8"
        }
    }
    Unfortunately with
    Aspects
    one isn’t allowed to define the version in the
    plugins
    block, so I had to add the version to the
    buildSrc/build.gradle.kts
    dependencies {
        ...
        implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72")
        ...
    }
    The stacktrace:
    Stacktrace
    v
    • 2
    • 7
  • r

    Radoslaw Juszczyk

    02/02/2021, 6:54 AM
    Is it possible to import
    org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
    class to my buildSrc module? I have written an extension function for configuring my ios target in my multiplatform project, but since it is also multi module project I have that function repeated in each module’s gradle script - would be nice to be able to move that to one place.
    v
    • 2
    • 12
  • j

    Jrichards1408

    02/02/2021, 11:59 AM
    Hi, i am new to using gradle kotlin DSL and was wondering how do u add a buildConfig variable on it? I tried adding
    buildConfigField("String", "BUILD_TIME", "\"${minutesSinceEpoch}\"")
    as an example but buildConfigField does not exist and could not see a similar function?
    m
    • 2
    • 3
  • s

    Stephan Schroeder

    02/04/2021, 8:45 AM
    For some reason I fail to import/export my kotlin lib (https://github.com/simon-void/ksv4ever) from/to JitPack which is very strange because according to JitPack (https://jitpack.io/), I only have to add this to my build-file
    repositories {
        maven(url = "<https://jitpack.io>")
    }
    dependencies {
    	implementation("com.github.User:Repo:Tag")
    }
    to my gradle-build file, in my case that's
    repositories {
        maven(url = "<https://jitpack.io>")
    }
    dependencies {
    	implementation("simon-void:ksv4ever:1.1.3")
    }
    So I've done just that, but the lib is simply not present/correctly imported. What am I missing?? Does Jippack have a requirement of an pom.xml being presen? (The intro doesn't mention it.) Version 1.1.3 is actually configured to produce a pom.xml file (see https://github.com/simon-void/ksv4ever/blob/master/build.gradle.kts) but for some reason doesn't.
    v
    • 2
    • 9
  • s

    Shannon Rhodes

    02/04/2021, 9:27 PM
    Is fromPreset still in use? getting an error
    fromPreset(presets.js, "js") {
                       ^ Unresolved reference: fromPreset
    v
    • 2
    • 1
  • d

    Dariusz Kuc

    02/08/2021, 7:42 PM
    Hello 👋 :gradle: 🧙 I got a proto monorepo that contains a number of different service definitions from which I generate stubs using protobuf plugin. While this setup currently works fine, as the size of the repo grows so does the resulting JAR (currently over 10MB(!)). In addition to the single JAR I'd also like to start providing smaller JARs based on their packages. e.g. I can dynamically create submodules as
    // settings.gradle.kts
    File(rootDir, "src/main/proto").listFiles()?.filter { directory ->
        directory.isDirectory && java.nio.file.Files.walk(directory.toPath())
            .filter { it.toString().endsWith(".proto") }
            .findAny()
            .isPresent
    }?.forEach { service ->
        include(":services:${service.name}-model")
    }
    And then in the build file
    configure(subprojects.filter { it.name != "services" }) {
        val service = this.name
        tasks {
            val serviceJar by registering(Jar::class) {
                from(rootProject.sourceSets["main"].output) {
                    include("$service/**")
                }
            }
            val sourcesJar by registering(Jar::class) {
                archiveClassifier.set("sources")
                from(rootProject.sourceSets.main.get().allSource) {
                    include("$service/**")
                }
            }
            publishing {
                publications {
                    create<MavenPublication>("mavenJava") {
                        artifact(serviceJar)
                        artifact(sourcesJar)
                    }
                }
            }
        }
    }
    Problems arise if I want to verify whether those smaller repackaged JARs are valid, i.e. proto definitions can reference some files from other (common) packages. I'm thinking that I could store those dependencies in build configuration, e.g. just a map of package to list of dependent packages which could then be used to populate POM dependencies. The problem I'm trying to figure out id how to validate the resulting JARs at build time (whether it specifies all the necessary dependencies) - any ideas how to re-trigger compilation of the specific sources?
    t
    • 2
    • 11
  • t

    tylerwilson

    02/08/2021, 8:58 PM
    Not sure if this should be in multiplatform or here, but it seems more like a gradle thing, so here it goes. I am refactoring my existing multiplatform library build.gradle/settings.gradle into build.grade.kts/settings.gradle.kts. Part of this is moving from the ‘old’ apply plugin to the ‘new’ plugins block. I spent some time getting the gradle build to work from Xcode via the cocoapods script. But when I go back into Android Studio I get this error:
    Plugin request for plugin already on the classpath must not include a version
    the plugins like is like so:
    id("org.jetbrains.kotlin.multiplatform") version "1.4.21"
    So I need that version to work from iOS (which appears to go through the settings.gradle.kts resolutionStrategy eachPlugin block), but AS does not like it. Anybody have a solution handy?
    v
    t
    • 3
    • 21
  • s

    Shannon Rhodes

    02/09/2021, 6:34 PM
    When I run
    ./gradlew build
    , I'm getting this message in the CLI very frequently.
    Expiring Daemon because JVM heap space is exhausted
    any suggestions?
    m
    • 2
    • 3
  • n

    no

    02/11/2021, 2:01 PM
    Have you tried not using the inline function? Inline functions are not supported with compile avoidance.
    s
    • 2
    • 3
  • s

    Shannon Rhodes

    02/11/2021, 6:06 PM
    is there a way to run a build for only 1 target?
    m
    • 2
    • 2
  • r

    rocketraman

    02/11/2021, 6:48 PM
    Anyone know the Gradle Kotlin DSL equivalent of
    classpath = project.configurations.runtime
    ?
    • 1
    • 2
  • f

    Filip Wiesner

    02/12/2021, 9:09 AM
    👋 Is there a way to access
    KotlinDependencyHandler
    in
    buildSrc
    so we can call
    implementation(...)
    there (using function with receiver e.g
    fun KotlinDependencyHandler.installDependencies(){}
    ) instead of in
    build.gradle.kts
    ?
    j
    t
    +2
    • 5
    • 35
  • n

    nanodeath

    02/14/2021, 11:03 PM
    hey all -- I'm trying to copy all my
    implementation
    dependencies into build/lib, but a Copy task with
    from(configurations.compile)
    isn't copying anything at all; I think I need something special to get the Kotlin project's dependencies or something. suggestions?
    v
    • 2
    • 16
  • s

    Sangeet Narayan

    02/15/2021, 3:38 AM
    Hey all, making a multi-module kotlin gradle application project for the first time. Just made the project structure for now and tried to run it with
    gradle run
    but it gave me this error:
    Error: Could not find or load main class com.demo.AppKt
    Caused by: java.lang.ClassNotFoundException: com.demo.AppKt
    Here’s the declaration of main class in my gradle file configuration (will be happy to share the whole file as well):
    application {
        mainClassName = "com.demo.AppKt"
    }
    And here’s my project structure:
    demo(root folder)
      -- application(module 1)
        -- src/main/kotlin
              --com.demo
                -- App.kt
        -- build.gradle.kt
      -- login (module 2)
      -- build.gradle.kt
      -- (other build, IDE and gradle folders)
    Can anyone tell what error am I doing?
    v
    • 2
    • 16
  • r

    Razak

    02/16/2021, 7:10 PM
    Hi , a question on two ways of adding implementation dependencies 1. implemention "artifact detail's" 2.implemention project("project name") Are they same? End of the day their in classpath in same way? are their advantages of defining with project ? *Considering include build multi modules project structure
    t
    t
    • 3
    • 3
  • b

    Ben Lancaster

    02/17/2021, 2:44 PM
    I posted this over in #multiplatform but suspect it may actually belong here, can anyone provide any insight as the correct way forward?
    t
    • 2
    • 2
  • s

    Samuel Bichsel

    02/18/2021, 12:51 PM
    I already asked the question in the #ios channel and saw now, that there is this one. Could anyone please help us with the following problem? https://kotlinlang.slack.com/archives/C9JM6Q2UX/p1613645954048000
    t
    • 2
    • 14
  • m

    myanmarking

    02/19/2021, 10:06 AM
    is there any website that indicates version for gradle/AGP in specific version of AS Artic Fox ?
    j
    • 2
    • 17
  • b

    Björn Mayer

    02/21/2021, 8:52 PM
    Heyho, I have a gradle multi module project. Some of my modules are using Kotlin for jvm. Some may use Kotlin JS. I’d like to specify JUnitPlatform for all modules that have the
    KotlinPlatformJvmPlugin
    applied. This is what I tried so far in my root `build.gradle.kts`:
    subprojects {
        plugins.withType<KotlinPlatformJvmPlugin> {
            dependencies {
                "testImplementation"(kotlin("test-junit5"))
            }
    
            tasks.withType<Test> {
                useJUnitPlatform()
            }
        }
    }
    and
    subprojects {
         if (pluginManager.hasPlugin("kotlin-platform-jvm")) {
            // dependency
            // useJunit blabla
         }
    }
    Both do not work. Is there a way to do this?
    ✅ 1
    a
    v
    j
    • 4
    • 4
  • b

    Brian Dilley

    02/23/2021, 3:59 AM
    I’d like to move a lot of this to separate files things. Like a
    publishing.gradle.kts
    , and
    signing.gradle.kts
    and
    native.gradle.kts
    - but i’m having trouble because I can’t find the equivelant of
    apply from
    for the kotlin style syntax: https://github.com/briandilley/ffmpeg4kj/blob/main/kotlin/build.gradle.kts
    t
    v
    • 3
    • 3
  • b

    Bee

    02/23/2021, 9:41 AM
    Hi everyone, I'm having a problem with a gradle project based on this gradle sample. My application code fails at this line:
    val config = mapper.readValue(File("Greeter.yaml"), JsonObject::class.java)
    without any exception details relevant to the code. All I get is the following stacktrace from gradle with no info about what actually failed:
    Execution failed for task ':app:run'.
    > Process 'command 'C:\JDK\zulu11.39.15-ca-fx-jdk11.0.7-win_x64\bin\java.exe'' finished with non-zero exit value 1
    
    * Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:run'.
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$3(ExecuteActionsTaskExecuter.java:186)
    	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:268)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:184)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
    	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
    	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
    	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
    	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
    	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:411)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:398)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:391)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:377)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
    	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    Caused by: org.gradle.process.internal.ExecException: Process 'command 'D:\Tools\zulu11.39.15-ca-fx-jdk11.0.7-win_x64\bin\java.exe'' finished with non-zero exit value 1
    	at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:414)
    	at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:42)
    	at org.gradle.api.tasks.JavaExec.exec(JavaExec.java:154)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
    	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
    	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
    	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:494)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
    	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:479)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:462)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$400(ExecuteActionsTaskExecuter.java:105)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:273)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:251)
    	at org.gradle.internal.execution.steps.ExecuteStep.lambda$executeOperation$1(ExecuteStep.java:66)
    	at org.gradle.internal.execution.steps.ExecuteStep.executeOperation(ExecuteStep.java:66)
    	at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:34)
    	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:47)
    	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:44)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
    	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
    	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:44)
    	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:34)
    	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:72)
    	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:42)
    	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:53)
    	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:39)
    	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:44)
    	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:77)
    	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:58)
    	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:54)
    	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:32)
    	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:57)
    	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:38)
    	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:63)
    	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:30)
    	... truncated for brevity
    Am I doing something wrong here?
    v
    • 2
    • 6
Powered by Linen
Title
b

Bee

02/23/2021, 9:41 AM
Hi everyone, I'm having a problem with a gradle project based on this gradle sample. My application code fails at this line:
val config = mapper.readValue(File("Greeter.yaml"), JsonObject::class.java)
without any exception details relevant to the code. All I get is the following stacktrace from gradle with no info about what actually failed:
Execution failed for task ':app:run'.
> Process 'command 'C:\JDK\zulu11.39.15-ca-fx-jdk11.0.7-win_x64\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:run'.
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$3(ExecuteActionsTaskExecuter.java:186)
	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:268)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:184)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:411)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:398)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:391)
	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:377)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: org.gradle.process.internal.ExecException: Process 'command 'D:\Tools\zulu11.39.15-ca-fx-jdk11.0.7-win_x64\bin\java.exe'' finished with non-zero exit value 1
	at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:414)
	at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:42)
	at org.gradle.api.tasks.JavaExec.exec(JavaExec.java:154)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:494)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:479)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:462)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$400(ExecuteActionsTaskExecuter.java:105)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:273)
	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:251)
	at org.gradle.internal.execution.steps.ExecuteStep.lambda$executeOperation$1(ExecuteStep.java:66)
	at org.gradle.internal.execution.steps.ExecuteStep.executeOperation(ExecuteStep.java:66)
	at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:34)
	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:47)
	at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:44)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:44)
	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:34)
	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:72)
	at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:42)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:53)
	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:39)
	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:44)
	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:77)
	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:58)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:54)
	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:32)
	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:57)
	at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:38)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:63)
	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:30)
	... truncated for brevity
Am I doing something wrong here?
v

Vampire

02/23/2021, 9:57 AM
What you are doing wrong here is, that you split your thread in three messages. Now if someone follows this thread in his threads view, he just sees "Am I doing something wrong here?" without the context of the first two messages. Either use one message or create a thread please. As for the error, it just says that your process exited with exit code 1. That is most likely not a Gradle problem, but a problem in your code. Scroll up, usually you should have get error output that tells you what the actual problem is before.
b

Bee

02/23/2021, 10:00 AM
Thanks for the notice about the thread split. Is there a way to move the messages to the original thread with the error details?
v

Vampire

02/23/2021, 10:00 AM
Just by deleting the messages and re-posting in the thread
👍 1
Or at least I know no other way
👍 1
b

Bee

02/23/2021, 10:04 AM
Thanks too or the hint about the error being detailed earlier. I found it, followed by a looong chunk of gradle logs, that in turn ended with the stacktrace I posted above.
v

Vampire

02/23/2021, 10:13 AM
Well, the stack trace is only shown if you choose so by running with
-s
or
--stacktrace
for that exact same reason, often it obscures the real error
View count: 14