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

    darkmoon_uk

    09/11/2019, 12:24 AM
    Ok it's
    configurations.get("kapt").dependencies.add(DefaultExternalModuleDependency("com.google.dagger", "dagger-compiler", "2.11"))
    o
    1 reply · 2 participants
  • p

    Paul Woitaschek

    09/15/2019, 6:45 AM
    Has gradle some form of a global
    settings.gradle
    file? I want to change the buildCache dir for all projects (but don't want to add it to the project's
    settings.gradle
    because its completely specific to my build setup
    o
    5 replies · 2 participants
  • e

    egorand

    09/16/2019, 3:28 PM
    How granular is Gradle’s compilation caching for Kotlin? E.g., if Gradle decides that a module in a multi-module project has to be recompiled, will it compile all files, or only those that need recompilation?
    t
    4 replies · 2 participants
  • v

    voben

    09/16/2019, 7:23 PM
    I have a
    lint.gradle
    file in my android project which I want to convert to a
    .kts
    file. Here's what the 2 versions look like
    // .kts version
    android {
        lintOptions {
            isAbortOnError =true
            xmlReport =false
            setLintConfig(file("$rootDir/codeQuality/lint.xml"))
        }
    }
    
    // groovy version
    android {
        lintOptions {
            abortOnError true
            lintConfig file("$rootDir/codeQuality/lint.xml")
            xmlReport false
        }
    }
    The groovy version works fine but in the kts version I keep getting unresolved reference issues
    Line 1: android { ^ Unresolved reference: android
    . Any ideas on how I can resolve this?
    g
    1 reply · 2 participants
  • s

    Slackbot

    09/17/2019, 7:19 AM
    This message was deleted.
    t
    p
    2 replies · 3 participants
  • p

    Paul Woitaschek

    09/17/2019, 1:17 PM
    In android I have `buildTypes`:
    debug
    ,
    release
    ,
    ẁhatever
    . I can now declare kapt on one onf these buildTypes
    kaptDebug(myDependency)
    and now when I assemble that build type:
    module:assembleDebug
    it runs kapt. How does it work when I don't use the android plugin, but only the pure
    kotlin
    plugin. How can I create these build configurations so I get a
    assembleDebug
    ? I tried adding `sourceSets`:
    sourceSets {
          debug
          release
        }
    But that doesn't give me a
    assembleDebug
    task
    g
    3 replies · 2 participants
  • e

    eddumelendez

    09/21/2019, 7:10 AM
    Hi everyone, I can use the plugin via `plugins`block but in this case need to add another dependency to that plugin… how can I make the code below work using
    plugins
    block?
    buildscript {
        ...
        dependencies {
            classpath("org.springframework.cloud:spring-cloud-contract-gradle-plugin:2.2.0.M2")
            classpath("org.springframework.cloud:spring-cloud-contract-spec-kotlin:2.2.0.M2")
        }
    }
    t
    1 reply · 2 participants
  • p

    Paul Woitaschek

    09/24/2019, 9:52 AM
    What would be the best way to let gradle install a git hook?
    e
    t
    8 replies · 3 participants
  • r

    ryn1x

    09/24/2019, 1:06 PM
    I'm new to gradle and trying to get junit tests working with intellij. When I click 'test' from the gradle menu I get "Test events were not received". Then if I manually run my tests class from intellij the tests run fine. Finally, if I click 'test' from the gradle menu after manually running the class, the tests run, but only one time and then back to "Test events not received". Any idea what is going on?
    c
    2 replies · 2 participants
  • h

    henrik

    09/27/2019, 7:05 AM
    Hi. I'm a little disappointed in how little help I get from IntelliJ after switching to kotlin-dsl. For example this snippet:
    tasks {
        val moduleTest by existing(Test::class) {
            setForkEvery(1)
        }
    }
    I'm not able to navigate to the
    Test
    class or to
    setForkEvery
    , and I don't get a list of other methods are available besides
    setForkEvery
    . Is there anything I can do to improve the situation?
    g
    t
    15 replies · 3 participants
  • x

    Xavier F. Gouchet

    09/27/2019, 4:00 PM
    Hello devs, I'm migrating all my gradle scripts from groovy to kotlin, and finding myself in a dead end it seems. Most of it is working well, but I used to have a single script to configure specific plugins, eg
    detekt.gradle
    that would apply the same detekt config to all projects needing it. Now when I try to do that, I can still use the
    apply(from("path/to/detekt.settings.gradle.kts"))
    , but apparently anything I put in the settings script doesn't have the usual imports, and cannot resolve any of the extensions.
    t
    p
    +1
    23 replies · 4 participants
  • i

    Imran/Malic

    10/01/2019, 9:38 AM
    Is there a way to access a jar within my own gradle plugin? Every help is welcome.
    x
    m
    8 replies · 3 participants
  • z

    zachtib

    10/02/2019, 1:15 PM
    Is there a way to only have
    kotlin_version
    defined in one place when using gradle kts and buildSrc? I’ve tried having an object inside of buildSrc, but I can’t reference that in buildSrc’s
    build.gradle.kts
    plugin block itself. I’ve tried putting it into gradle.properties and reading it out, which requried a workaround I found on github, but then didn’t work outside of the
    buildSrc
    module. This seems like something there should be a good accepted solution for
    t
    15 replies · 2 participants
  • i

    Imran/Malic

    10/03/2019, 1:56 PM
    What does the
    ToolingModelBuilderRegistry
    do
    t
    6 replies · 2 participants
  • j

    Joao Birk

    10/03/2019, 9:19 PM
    Hi there, so we migrated our Gradle Groovy scripts to Kotlin-DSL. In the past few days we realized that the IDE has become very unresponsive when editing files, copying or pasting stuff. Has anyone faced the same issue? I found this link: https://docs.gradle.org/current/userguide/kotlin_dsl.html "In addition, IntelliJ IDEA and Android Studio might spawn up to 3 Gradle daemons when editing Gradle scripts — one for each type of script: build scripts, settings files and initialization scripts. Builds with slow configuration time might affect the IDE responsiveness, so please check out the performance guide to help resolve such issues." Seems I'm gonna have to do some performance testing in order to figure this out. Wonder if anyone faced this and can pin point a solution.
    s
    3 replies · 2 participants
  • s

    stepango

    10/05/2019, 5:12 AM
    Hi everyone! I’m trying to do some weird stuff with gradle and I need your help:) I have main module which is `Android Application`(1) and I have one more module with `no plugins applied`(2). The current problem I have is: I want module (1) to get jar dependency from (2) like:
    exec {
    // very long operation to get this jar file from somewhere
    }
    
    configurations.maybeCreate("default")
    artifacts.add("default", file("${libName}.jar"))
    But what if I want to do this in execution stage? First problem I faced is I can’t add artifacts lazily and second one is - there is no tasks executed in project (2) by default. I bit more context is here https://github.com/stepango/bali/blob/master/bazel_wrapper/build.gradle Any suggestions are welcome.
    s
    n
    4 replies · 3 participants
  • p

    Paul Woitaschek

    10/06/2019, 2:10 PM
    How can I deduplicate the repositories block that occurs twice in the buildScript and the allProjects block?
    e
    c
    7 replies · 3 participants
  • u

    ursus

    10/09/2019, 4:21 AM
    I think it went like project.something("android").lintOptions = ..
    v
    4 replies · 2 participants
  • u

    ursus

    10/09/2019, 5:17 AM
    I somehow bashed at it and found this working
    allprojects {
        ..
    
        afterEvaluate {
            // Apply lintOptions to every android module
            def android = it.extensions.findByName("android")
            if (android != null) {
                android.lintOptions {
                    lintConfig rootProject.file("lint.xml")
                }
            }
        }
    
        ..
    }
    is there obviously something wrong with it? thanks
    t
    p
    9 replies · 3 participants
  • j

    Justin

    10/12/2019, 4:17 PM
    I’m working on a (first) custom gradle plugin for my team’s projects to use. I’m creating it for both common tasks but also to have access to the same classes/members across each project’s build.gradle files. When I apply the plugin inside a project’s build.gradle, I can only see (IDE completion) the Java classes in my plugin. I can’t see any of the Kotlin classes, but if I sync gradle or build/assemble, it works without any issues (i.e. the task/build does not fail). But the non-Java class I import is red/unresolved. Am I missing something?
    t
    t
    6 replies · 3 participants
  • m

    Matej Drobnič

    10/15/2019, 7:41 AM
    Is there a way to suppress
    Kotlin plugin should be enabled before 'kotlin-kapt'
    error message? I have gradle script like this:
    plugins {
        kotlin("kapt") version Versions.kotlin
    }
    
    subprojects {
        kapt {
            useBuildCache = true
        }
    }
    Basically, I want to automatically enable build cache on all projects. But since some projects are android and some are regular kotlin, I cannot apply any plugin in this root gradle script, I only need the kapt.
    g
    t
    +1
    24 replies · 4 participants
  • b

    Bernhard

    10/15/2019, 1:06 PM
    how do you configure junit 5 so that it finds your tests?
    5 replies · 1 participant
  • j

    jmfayard

    10/22/2019, 10:03 AM
    In case you wanted to use Gradle+Kotlin in your *Android *build, but you were blocked by the Android team doing absolutely nothing to make it happen (except showing a popup to say that there are not supporting it) here is a nice work-around: - Extract the
    android { ... }
    block to a separate file
    app/android.gradle
    - Convert the rest of
    app/build.gradle
    to
    app/build.gradle.kts
    - Add in `app/build.gradle.kts`:
    apply(from = "android.gradle")
    Example here: https://github.com/jmfayard/update-legacy-android-project/commit/a22c3c4cad4f8db7d562bf7313e23f21b7f7c0d4
    🙏 3
    r
    m
    +4
    47 replies · 7 participants
  • j

    Javier

    10/22/2019, 9:32 PM
    KotlinOptions is missing from android plugin, someone has created the extension function?
    g
    1 reply · 2 participants
  • j

    Javier

    10/22/2019, 9:46 PM
    Maybe?
    g
    4 replies · 2 participants
  • m

    mantono

    10/23/2019, 10:25 AM
    Hello! I am using
    api
    instead of
    implementation
    for a dependency in my library, because my library builds as an extension on top of that library and would not be very usefull without. However, when someone uses my library the dependency declared with
    api
    is not exposed. Is there something I could have done wrong?
    m
    o
    12 replies · 3 participants
  • s

    Sujit

    10/24/2019, 5:42 PM
    I'm a bit confused with gradle here. Why does
    repositories {
            maven {
                name "Local"
                url uri("/Users/sujit.poudel/dev/android/TestProj1/build/")
            }
    }
    can resolve all the artifacts in the build as maven artifacts, but not:
    repositories {
            maven {
                name "Local"
                url uri("$projectDir/build/")
            }
    }
    does not in android project? I checked the value of
    $projectDir
    , and it is:
    /Users/sujit.poudel/dev/android/TestProj1
    . Any pointer here please?
    o
    1 reply · 2 participants
  • d

    davidasync

    10/25/2019, 5:16 AM
    Related with kotlin dsl how we change this piece of code
    maven {
          url "<http://abc.com|abc.com>"
          credentials(AwsCredentials) {
            accessKey = "a"
            secretKey = "b"
            sessionToken = "c"
          }
        }
    to kotlin dsl ?
    g
    o
    9 replies · 3 participants
  • b

    Bernhard

    10/25/2019, 1:40 PM
    how do I exclude a task from another task?
    b
    9 replies · 2 participants
  • b

    Bernhard

    10/25/2019, 1:40 PM
    I never want to run test when running build
    s
    g
    5 replies · 3 participants
Powered by Linen
Title
b

Bernhard

10/25/2019, 1:40 PM
I never want to run test when running build
s

serebit

10/25/2019, 1:41 PM
just run
assemble
instead
b

Bernhard

10/25/2019, 1:41 PM
doesn't help if intellij uses build
g

gildor

10/25/2019, 3:02 PM
Do not use build, it's configurable after all
build
means "assemble all the code and run all the tests"
👆 1
This task is special (aka lifecycle task) created for this, to run all checks
View count: 1