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

    Anton Afanasev

    12/09/2021, 8:12 PM
    Hi all. I am trying to create a custom task that check dependency graph, verify that some dependency are present and fail build if they are. I have a
    dependency
    task that prints all the dependencies, but I am not able to assemble that pieces to a working solution.
    tasks.register("checkForAndroidxDependencies") {
        description = "verify that no androidx dependencies are present"
        group = "verification"
    
        dependsOn("androidDependencies") // how do I get the output of the androidDependencies?
       
        doLast {
            exec {
                commandLine = listOf("grep", "androidDependencies") // Are there any way to execute the "grep" on the androidDependencies?
            }
        }
    }
    Any help will be much appreciated.
    v
    • 2
    • 3
  • g

    Gabriel Duncan

    12/09/2021, 11:25 PM
    Hello again Kotlin Kommunity. I would like to know if there’s a smart way to read
    gradle.properties
    files between modules. For example if I have
    project/
        module1/
            gradle.properties
        module2/
            gradle.properties
    ...etc
    and in
    module2
    i want to be able to pull a property from
    module1
    like say
    appVersion
    is there a way to do this? or is that just a bad idea?
    j
    v
    • 3
    • 4
  • a

    Anton Afanasev

    12/13/2021, 3:00 PM
    Good morning, Gradle Masters. Any ideas why during project build gradle does not throw/fail with an Exception? I am getting the
    should throw
    printed in build logs, but for some reason it is BUILD SUCCESSFUL
    project.configurations.all {
        resolutionStrategy.eachDependency {
            if (this.requested.name.contains("abc")) {
                println("should throw")
                throw IllegalArgumentException("Can not use abc dependency ")
            }
        }
    }
    d
    • 2
    • 4
  • t

    tapchicoma

    12/14/2021, 2:31 PM
    FYI: If you are using Gradle 7.0-7.1, configure Kotlin daemon options via
    org.gradle.jvmargs=-Dkotlin.daemon.jvm.options=...
    plus using Kotlin DSL - it may happen spawned Kotlin daemon will ignore them. This is happening when Kotlin DSL scripts are compiling and this workaround is set by Gradle. Either update Gradle version or use
    kotlin.daemon.jvmargs
    property.
    :tnx: 2
    • 1
    • 1
  • p

    Paul Woitaschek

    12/14/2021, 3:54 PM
    What could be the reason for this huge white gap between the configuration and the execution phase?
    t
    v
    +2
    • 5
    • 20
  • r

    rocketraman

    12/14/2021, 8:17 PM
    I have two multi-platform builds -- neither of which have a
    compileClasspath
    configuration or
    main
    source set. However, if I include the second build in the first build, now I get a
    compileClasspath
    configuration coming from a
    main
    source set (and this breaks the jetbrains compose runtime dependency). Any ideas on where to look?
    • 1
    • 2
  • j

    Javier

    12/15/2021, 2:49 PM
    TBH maybe this is not related to Gradle but not sure where I should post this one. I have a custom theme in an isolated module for compose based on the library material, thanks to Gradle I can just use
    implementation
    instead of
    api
    to avoid exposing Material, but it is becoming inviable the amount of dupe code of things are not going to change in the foreseeable future (animations for example). So I moved my components to be a mix of my custom theme params plus material params. Problem is I don't want expose some composables/imports from Material lib, so they can't be imported and not only fix the issue of IDE suggesting them, even just failing in compile time too. Is it possible to be done with Gradle easily?
    y
    • 2
    • 1
  • p

    Peter

    12/15/2021, 9:29 PM
    is there an advantage to publishing gradle plugins to the gradle plugin portal or is sonatype/central fine?
    m
    k
    e
    • 4
    • 11
  • p

    Patrick Ramsey

    12/15/2021, 10:46 PM
    Dumb question --- what’s the correct way to make a custom task that doesn’t take parameters? It seems like if I don’t specify any @Inputs, gradle complains that the constructor should be annotated with @Inject. If I annotate the task constructor with @Inject, gradle complains that the constructor doesn’t take any parameters.
    e
    v
    • 3
    • 12
  • u

    ursus

    12/16/2021, 3:45 PM
    Is there anything I can do to improve configuration time? I already went through unnecessary plugins and dependencies, yet its like 15seconds Anything other than "not have so many modules"?
    v
    • 2
    • 7
  • p

    Peter

    12/16/2021, 3:50 PM
    anyone know how to fix:
    Reason: Task ':generateMetadataFileForPluginMavenPublication' uses this output of task ':publishPluginJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
    ?
    v
    • 2
    • 10
  • u

    ursus

    12/16/2021, 5:15 PM
    what is this gap? is it possibly gc or something? because the one bar going thourgh the gap, is for sure not something others are awaiting for (its 3 apps being built, so app module of appA for sure is not a dependency to appB etc)
    t
    • 2
    • 1
  • g

    Gabriel Duncan

    12/16/2021, 10:06 PM
    this is a pretty simple task that i’m having trouble finding an answer for, but is there a way to set an environment variable for all tasks from the gradle build file? it looks like the `JavaExec`type task allows for it by providing a
    setEnvironment
    method, however i want it to be available for all of my
    jsBrowser..
    type tasks. so in summary i want to: 1. get a value from the properties file ✅ — this is easy 2. set that as an env variable from the gradle.build.kts file so that its available to all tasks any help will be greatly appreciated!
    • 1
    • 1
  • u

    ursus

    12/18/2021, 2:25 PM
    Hey I noticed every android gradle module has debug & release variants. I think it would help config times if I were to disable the release variant, as its never necessary in our case in local development How would I do that?
    j
    e
    • 3
    • 4
  • j

    jannis

    12/21/2021, 3:57 PM
    Is there a nice way to have 2 distinct sets of instrument tests on android (I assumed it would be the same for plain unit tests)? E.g. I have my normal set of Tests
    A
    . But sometimes I want to run a defined set of Tests
    B
    but not run the Tests from
    A
    . I tried utilizing
    @LargeTest
    etc and Test suites, but it didn't seem to work out nicely 💭 I'd love to not touch Tests
    A
    in any way. Note: All tests are within one gradle module
    t
    b
    • 3
    • 6
  • k

    K Merle

    12/21/2021, 6:38 PM
    I've migrated groovy to kotlin dsl, I am able to build an app, but I am unable to get rid of the warnings in AS. Anyone encountered it?
    v
    f
    • 3
    • 7
  • d

    darkmoon_uk

    12/23/2021, 5:38 AM
    Is it an unexpected use case to write extension-functions for a plugin's classes in
    buildSrc
    ? I'm hitting unexpected trouble quite early on 🧵 👉
    b
    j
    • 3
    • 5
  • c

    Chrimaeon

    12/24/2021, 11:40 AM
    Hey guys! I'm using some Kotlin features in my
    build.gradle.kts
    that are experimental and require a
    RequiresOptIn
    annotation like
    @ExperimentalPathApi
    . I'm using those in the build script with the
    @OptIn
    annotation. Problem/Issue now is a warning in the build script that I did not add the
    RequiresOptIn
    to the kotlin compiler options - but where do I add this compiler option for the Gradle script Kotlin compiler? An example of the issue can be seen here: https://github.com/chrimaeon/curriculumvitae/blob/03663b8ee32f3f83746536f7ac093df5a93a5953/app/build.gradle.kts#L40
    👀 1
    n
    • 2
    • 2
  • m

    mbonnin

    12/26/2021, 3:13 PM
    Is there a specific reason to use Gradle properties for things like
    kotlin.mpp.stability.nowarn
    ,
    kotlin.native.binary.memoryModel
    or
    kotlin.stdlib.default.dependency
    ? I'd love these to be moved to setters/getters APIs in the "kotlin" extension instead: 1. that'd allow proper API lifecycle management (preview, stable, deprecated) and avoid cluttering the
    gradle.properties
    file with properties that are not supported any more 2. that can be more precise about when the property is needed. I understand something like
    kotlin.native.binary.memoryModel
    is only for binaries so adding it only in
    binaries {}
    makes this explicit compared to a global
    gradle.properties
    prop 3. Maybe it'll play better with Gradle configuration cache?
    b
    t
    +2
    • 5
    • 11
  • t

    tseisel

    12/30/2021, 9:49 AM
    I have a Gradle project with a lot of Kotlin sub-mobules. I'd like to configure
    kotlinOptions
    and
    kapt
    for each of those modules without repeating myself, how can I centralize configuration ? I've found very few official resources on Kotlin project modularization.
    v
    • 2
    • 3
  • d

    dave08

    12/30/2021, 12:56 PM
    I posted this on #android, but maybe this is a better place for this question: Is it possible to compile multiple android gradle modules into one aar file using Kotlin DSL, or do I have to publish each one separately? Say I have a
    :common
    some-android-lib
    depends on
    :common
    and
    android-app
    depends on
    some-android-lib
    , I want to only publish
    some-android-lib
    to maven and include
    :common
    in it, and then only refer to
    some-android-lib
    in
    android-app
    ...
    e
    v
    • 3
    • 71
  • j

    Jast Lai

    12/30/2021, 8:58 PM
    Hi, I‘m having an android  project. and I notice it try to find some directory that I had never create when I try to assemble it , and if I got lot of flavors. It looks like spent lot of time to find those directories that never exist. Can I skip those step ? If I skip those step, would it help me to optimize build time ?
    e
    • 2
    • 1
  • k

    Ky

    12/31/2021, 3:56 AM
    Is it possible to get autocompletion for build.gradle files in AS?
    v
    • 2
    • 1
  • f

    Francesc

    01/02/2022, 6:33 PM
    In a multi-module project, with Groovy, I can have a base gradle file that is imported into other files, using
    apply from: "$rootDir/base_library_module.gradle"
    - is there something equivalent with Kotlin DSL for
    build.gradle.kts
    ?
    j
    h
    +3
    • 6
    • 11
  • j

    Joffrey

    01/03/2022, 4:48 PM
    Is there an equivalent to 
    maxParallelForks
     for 
    KotlinNativeTest
     tasks in Gradle? I'm trying to prevent native macOS tests from running in parallel, but I can't seem to find the correct config. Note that my diagnosis might be wrong, but I'm getting an error that I used to get because of parallelism (my tests access an external resource that doesn't support parallelism). (this used to be posted in #kotlin-native but got no answer in a few days, so I guess this channel might be more appropriate)
    e
    • 2
    • 7
  • p

    Peter

    01/05/2022, 5:22 PM
    does anyone know why this example of convention plugins in the documentation doesn’t work or what’s needed to make it work? https://docs.gradle.org/current/userguide/declaring_dependencies_between_subprojects.html#sec:project_jar_dependencies
    j
    e
    • 3
    • 12
  • t

    Tomasz Krakowiak

    01/09/2022, 9:08 PM
    Anyone knows how to create gradle JavaExec configuration for multiplatform project?
    tasks.create<JavaExec>("run") {
        classpath = //?
        mainClass.set("com.example.MainKt")
    }
    sourceSets
    container is at this point empty.
    configurations
    container does not have
    jvmMainRuntime
    configuration.
    h
    e
    • 3
    • 3
  • t

    Tomasz Krakowiak

    01/10/2022, 2:29 PM
    I'm trying to include output of copy task in jvm resources inside multiplatform project, but they're not effectively present in jar, not avaiable to run task. Is there proper way to do it? Other than modyfing jar and run tasks.
    kotlin.jvm().compilations["main"].defaultSourceSet.resources.compiledBy(someCopyTask){
        val directoryProperty = project.objects.directoryProperty()
        directoryProperty.set(someCopyTaskOutputDir)
        directoryProperty
    }
    • 1
    • 1
  • u

    Utkarsh Tiwari

    01/11/2022, 12:38 PM
    Hi, I am trying to publish a module named 
    core_ds_component
     of an Android project to artifactory. When I run the publish command, I get this error. I couldn’t find dokka in the dependency graph of this module. Does anyone has any idea what could be wrong?
    k
    • 2
    • 2
  • p

    pabl0rg

    01/12/2022, 9:05 PM
    Hello! Is anyone else seeing this error today?
    Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.6.0'] was not found in any of the following sources:
    - Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
    - Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.6.0')
      Searched in the following repositories:
        MavenRepo
        BintrayJCenter
        BintrayJCenter2
        maven(<https://plugins.gradle.org/m2/>)
        maven2(<https://oss.sonatype.org/content/repositories/snapshots/>)
        maven3(<https://www.jetbrains.com/intellij-repository/releases/>)
        maven4(<https://jetbrains.bintray.com/intellij-third-party-dependencies>)
    e
    c
    k
    • 4
    • 4
Powered by Linen
Title
p

pabl0rg

01/12/2022, 9:05 PM
Hello! Is anyone else seeing this error today?
Plugin [id: 'org.jetbrains.kotlin.jvm', version: '1.6.0'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:1.6.0')
  Searched in the following repositories:
    MavenRepo
    BintrayJCenter
    BintrayJCenter2
    maven(<https://plugins.gradle.org/m2/>)
    maven2(<https://oss.sonatype.org/content/repositories/snapshots/>)
    maven3(<https://www.jetbrains.com/intellij-repository/releases/>)
    maven4(<https://jetbrains.bintray.com/intellij-third-party-dependencies>)
e

ephemient

01/12/2022, 9:06 PM
https://status.gradle.com/ (this was being discussed in https://kotlinlang.slack.com/archives/C09222272/p1642010555017800 but #gradle seems like a better place)
c

Colton Idle

01/12/2022, 9:08 PM
oh hey das me
😂 1
p

pabl0rg

01/12/2022, 9:34 PM
thanks!
k

Kedar

01/13/2022, 3:20 AM
If your app or any of your app dependencies are using jcenter, you'll see such errors as jcenter is down.
View count: 12