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

    Slackbot

    06/25/2019, 5:56 AM
    This message was deleted.
    o
    • 2
    • 4
  • u

    ursus

    06/26/2019, 3:55 AM
    Hey, guys anybody had issus with incremental apt? I turn it on via
    kapt.incremental.apt=true
    but then gradle breaks with
    * What went wrong:
    Execution failed for task ':core:kaptDebugKotlin'.
    > Could not resolve all files for configuration ':core:_classStructurekaptDebugKotlin'.
       > Failed to transform file 'classes.jar' to match attributes {artifactType=class-structure, org.gradle.usage=java-runtime-jars}
          > Execution failed for StructureArtifactTransform: C:\Users\ursus\.gradle\caches\transforms-2\files-2.1\d17b7c88a03f1112fe0ba327a2d0eee6\jars\classes.jar.
             > java.lang.IllegalArgumentException (no error message)
       > Failed to transform file 'runtime-jvm-1.1.3.jar' to match attributes {artifactType=class-structure, org.gradle.usage=java-runtime-jars}
          > Execution failed for StructureArtifactTransform: C:\Users\ursus\.gradle\caches\modules-2\files-2.1\com.squareup.sqldelight\runtime-jvm\1.1.3\133500e0dcd9092c8f376d5add6ad7c4afb7177e\runtime-jvm-1.1.3.jar.
             > java.lang.IllegalArgumentException (no error message)
       > Failed to transform file 'kotlin-stdlib-jdk7-1.3.40.jar' to match attributes {artifactType=class-structure, org.gradle.usage=java-runtime-jars}
          > Execution failed for StructureArtifactTransform: C:\Users\ursus\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jdk7\1.3.40\2995de8f68444ad47f29e7b59962ac31e6301d7e\kotlin-stdlib-jdk7-1.3.40.jar.
             > java.lang.IllegalArgumentException (no error message)
    
    .... truncated, same error but different dependency
    a
    i
    • 3
    • 3
  • s

    Stephan Schroeder

    06/26/2019, 3:22 PM
    how do i convert GroovyDSL
    task integrationTest(type: Test) {
        useJUnit {
            include '**/*IntegrationTest.class'
        }
    }
    to KotlinDSL? I tried
    task {
        named<Test>("integrationTest") {
            useJUnit {
                include("**/*IntegrationTest.class")
            }
        }
    }
    but get
    Task with name 'integrationTest' not found in root project
    .
    c
    • 2
    • 2
  • s

    Stephan Schroeder

    06/26/2019, 3:33 PM
    only 2 problems left: - the
    initialVersion
    makes problems
    scmVersion {
        versionIncrementer 'incrementMinor'
        tag {
            initialVersion = { config, position -> '1.0.0' }
        }
        checks {
            aheadOfRemote = false
            uncommittedChanges = false
        }
    }
    I got
    tasks {
        scmVersion {
            versionIncrementer("incrementMinor")
            tag {
                initialVersion = { config, position -> "1.0.0" }
            }
            checks(delegateClosureOf<ChecksConfig> {
                aheadOfRemote = false
                uncommittedChanges = false
            })
        }
    }
    but there is no longer an
    initialVersion
    available, closest thing is maybe
    init{versionCreator{...
    this wants some closure.
    • 1
    • 4
  • s

    Stephan Schroeder

    06/26/2019, 3:35 PM
    second and last thing is:
    tasks {
        publishing {
            publications {
                mavenJava(MavenPublication) {
                    from components.java
                }
            }
        }
    }
    but the
    mavenJava
    is red 😔 with
    unresolved reference: mavenJava
    . I assume I should have been included by this but didn’t
    plugins {
        id("java")
        `maven-publish`
    }
    • 1
    • 1
  • s

    Stephan Schroeder

    06/27/2019, 12:47 PM
    just to not hide my problem in the subthread. The only remaining problem now is that
    java
    can’t be resolved in
    tasks{
      publishing {
        publications {
          create<MavenPublication>("mavenJava") {
            from(components.get().java) //in groovy it's 'components.java'
    }}}}
    and according to the docu (https://docs.gradle.org/current/dsl/org.gradle.api.publish.maven.MavenPublication.html#N1BEBB) 3 types of component are supported: ‘components.java’ (added by the JavaPlugin) And I do import the javaPlugin:
    plugins {
        java
        `maven-publish`
    So I get why
    java
    can’t be found on
    components.get()
    statically (because it’s added dynamically by a different plugin). But how can i access it? This is the javadoc of the class
    CompoentReport
    and I’m still not able to figure it out: https://docs.gradle.org/current/javadoc/org/gradle/api/reporting/components/ComponentReport.html
    • 1
    • 1
  • f

    Fabian

    06/27/2019, 2:45 PM
    never mind I found out that the
    plugins {
        java
    }
    seems to be mandatory
    r
    • 2
    • 1
  • p

    Paulius Ruminas

    06/28/2019, 1:11 PM
    Hello, I get an error when trying to add
    androidx.navigation.safeargs.kotlin
    plugin to my project:
    Caused by: org.gradle.api.GradleException: androidx.navigation.safeargs.kotlin plugin must be used with kotlin plugin
    . settings.gradle.kts:
    pluginManagement {
        repositories {
            gradlePluginPortal()
            jcenter()
            google()
            mavenCentral()
        }
        resolutionStrategy {
            eachPlugin {
                when (requested.id.namespace) {
                    "org.jetbrains.kotlin" -> useModule("org.jetbrains.kotlin:kotlin-gradle-plugin:${Version.Kotlin}")
                }
    
                when (requested.id.id) {
                    "kotlinx-serialization" -> useModule("org.jetbrains.kotlin:kotlin-serialization:${Version.Kotlin}")
                    "com.android.application" -> useModule("com.android.tools.build:gradle:3.4.1")
                    "androidx.navigation.safeargs.kotlin" -> useModule("androidx.navigation:navigation-safe-args-gradle-plugin:${Version.NavigationKtx}")
                }
            }
        }
    }
    
    // ...
    build.gradle.kts:
    plugins {
        id("com.android.application")
        kotlin("android")
        kotlin("android.extensions")
        kotlin("kapt")
        id("androidx.navigation.safeargs.kotlin")
    }
    
    // ...
    m
    • 2
    • 4
  • a

    Allan Wang

    07/03/2019, 1:57 AM
    Does anyone know of any gradle plugin compatible with kotlin (kts) that can run node operations? Currently there’s https://github.com/srs/gradle-node-plugin but it’s dependent on Groovy closures
    g
    • 2
    • 11
  • n

    Nicholas Bilyk

    07/08/2019, 3:52 PM
    Sorry for the re-post, just learned of this channel 🙂 Hi Gradle experts. I'm pretty new to Gradle, and I'm having trouble figuring out how to get a Kotlin multi-platform multi-project build set up as a composite dependency. I'm using includeBuild to pull in the mpp utility project
    includeBuild("../acornui") {
    	dependencySubstitution {
    		substitute(module("com.acornui:acornui-utils-metadata")).with(project(":acornui-utils"))
    		substitute(module("com.acornui:acornui-utils-jvm")).with(project(":acornui-utils"))
    		substitute(module("com.acornui:acornui-utils-js")).with(project(":acornui-utils"))
            }
    }
    This actually works as far as building is concerned, but the IDE doesn't accept the substitution. Any suggestions for where I can go from here?
    • 1
    • 1
  • b

    bjonnh

    07/13/2019, 8:33 PM
    I'm getting an error with gradle: - Variant 'testRuntime' capability mystuff:api-library:unspecified: - Unmatched attributes: - Required org.gradle.category 'platform' but no value provided. - Required org.gradle.dependency.bundling 'external' but no value provided. - Required org.gradle.jvm.version '12' but no value provided. - Required org.gradle.usage 'java-api' but no value provided. - Found org.jetbrains.kotlin.localToProject 'local to :api-library' but wasn't required. - Compatible attribute: - Required org.jetbrains.kotlin.platform.type 'jvm' and found compatible value 'jvm'.
    :stackoverflow: 1
    :google: 1
    • 1
    • 5
  • v

    vishna

    07/16/2019, 10:45 AM
    Hi! I was wondering if there’s a way to enhance what
    gradle init --dsl kotlin --type kotlin-application
    is doing, namely instead of having:
    \
    |-\src
    |-build.gradle.kts
    |-settings.gradle.kts
    have it generate a project with app module & buildSrc.
    \
    |-\app
    |-\buildSrc
    |-build.gradle.kts
    |-settings.gradle.kts
    Rationale: I want to have more modules, reuse constants via buildSrc and default project layout is a PITA to change
    l
    • 2
    • 4
  • t

    thana

    07/16/2019, 12:54 PM
    aaaaand the problem is back 😞
    l
    • 2
    • 1
  • p

    PHondogo

    07/18/2019, 12:35 PM
    Hello! When I use apply(plugin="org.jetbrains.kotlin.multiplatform") kotlin { // <- error failed to resolve symbol .... } But configure<KotlinMultiplatformExtension> { // ok .... } When plugins{ kotlin("multiplatform") version "1.3.41" } kotlin { // <- OK .... } How can I make last variant work with apply construction? I need it cause I'm applying it in my custom gradle plugin and now it is not possible to use plugins in this case.
    e
    • 2
    • 3
  • v

    voben

    07/18/2019, 2:46 PM
    I’m trying to add a jar into a java library module, then pull that module into my app level build.gradle file as a dependency. Gradle syncs work. The issue is when I run gradlew assembleDebug, I keep getting the error
    Unresolved reference: creditcall
    Execution failed for task ':app:compileDebugKotlin'
    Library module: build.gradle
    apply plugin: 'java-library'
    dependencies {
        implementation files("libs/MyCurrencyJar.jar")
    }
    App module: build.gradle
    ...
    dependencies {
       ...
        implementation project(':myLibrary')
    }
    Can I add a jar to a library module this way?
    s
    • 2
    • 2
  • v

    voben

    07/19/2019, 12:54 AM
    Whenever I add a new module using android studio, it automatically adds it to the include function in
    settings.gradle
    file. Now the issue is, even if I have a
    settings.gradle.kts
    file, android studio creates a settings.gradle and adds my dependency in there rather than in the
    .kts
    version. Is there a way to tell AS to add the dependency to the existing settings.gradle.kts file rather than create a new settings.gradle?
    g
    a
    • 3
    • 4
  • d

    Dias

    07/19/2019, 9:46 AM
    Line 15:     kotlin("jvm") version "$kotlinVersion"
                                           ^ Unresolved reference: kotlinVersion`
    p
    g
    • 3
    • 20
  • u

    ursus

    07/21/2019, 6:31 PM
    Hi, im trying to run tests before
    assembleRelease
    Usually I do it in app build.gradle via
    afterEvaluate {
        assembleRelease.dependsOn test
    }
    However this doesnt work for my multimodule app, It seems that code only runs tests in :app I could add that block to every module's build file but that is error prone I tried
    allprojects {
       afterEvaluate {
           assembleRelease.dependsOn test
       }
    }
    * What went wrong:
    A problem occurred configuring root project 'icewarp-teamchat-android'.
    > Could not get unknown property 'assembleRelease' for root project 'abc' of type org.gradle.api.Project.
    d
    g
    • 3
    • 117
  • j

    Javier

    07/23/2019, 11:41 AM
    Is there a way to "apply dependencies" when it is not appearing on screen?
    ➕ 1
    g
    s
    • 3
    • 5
  • j

    Javier

    07/23/2019, 9:43 PM
    I am getting this warning at the top of screen. False positive? It is working and the app runs without issues.
    This script caused build configuration to fail, run 'gradle tasks' for more information
    Sin título
    e
    v
    • 3
    • 4
  • a

    Alanna

    07/25/2019, 6:19 PM
    Hi, I am having trouble getting my project to compile using the kotlin compiler I have built from source. I have created a kotlin starter project with
    gradle init --type kotlin-application
    and I have added the lines found here to my settings.gradle: https://github.com/JetBrains/kotlin/#including-into-composite-build When I do a
    ./gradlew build --info
    in my starter project, I can see that the there are
    :kotlin:*
    tasks running (though they re-run only after I do a
    ./gradlew dist
    in the kotlin compiler repo) but the changes I've made to the Kotlin compiler (I've added some print/logging statements) are not showing up. I'm new to gradle - do I need to disable running the kotlin compiler via the daemon, or do something else in my gradle files to point gradle at my built-from-source kotlin compiler? Any help would be greatly appreciated!! Also if this question fits better on the forum, please let me know; I would be happy to move it there 🙂
    t
    • 2
    • 1
  • u

    ursus

    07/26/2019, 4:41 PM
    noob question: why I dont I see `test`˛or
    build
    task in
    gradlew :tasks --all
    ? I only see module:build, module:test etc
    g
    • 2
    • 10
  • v

    vpriscan

    07/28/2019, 11:36 AM
    how to enable new type inference for the 1.3.40 compiler?
    g
    • 2
    • 1
  • s

    Stephan Schroeder

    07/29/2019, 3:47 PM
    so I’m trying to join several projects into a single multiproject one. This is the kotlin dsl for the parent build.gradle.kts (all subprojects are included via settings.gradle.kts). So the main idea is that we want common versioning for all subprojects: this is my code, but IntelliJ flags basically everything:
    subprojects {
    
        plugins {
            java
            idea
            `maven-publish`
            id("pl.allegro.tech.build.axion-release") version "1.9.3"
        }
    
        group = "uk.co.di.platform"
        version = scmVersion.version
    
    
        configure<JavaPluginConvention> {
            sourceCompatibility = JavaVersion.VERSION_11
            targetCompatibility = JavaVersion.VERSION_11
        }
    
        repositories {
            mavenCentral()
            mavenLocal()
        } 
    
        publishing {
            publications {
                create<MavenPublication>("mavenJava") {
                    from(components["java"])
                }
            }
        }
    
        tasks {
            scmVersion {
                versionIncrementer("incrementMinor")
                tag(delegateClosureOf<TagNameSerializationConfig> {
                    initialVersion = KotlinClosure2<TagProperties, ScmPosition, String>({ _, _ ->"1.0.0"})
                })
                checks(delegateClosureOf<ChecksConfig> {
                    aheadOfRemote = false
                    uncommittedChanges = false
                })
            }
        }
    }
    scmVersion is e.g. flagged as unresolved reverence, but it should have been made accessible by the axion-release plugin.
    l
    v
    • 3
    • 14
  • c

    Chris Miller

    07/30/2019, 2:01 PM
    I'm trying to upgrade a build script from 1.3.21 of kotlin-gradle-plugin to use a newer version, but when using 1.3.30 or higher the script fails at runtime with: "Resolving configuration 'jsMainImplementation' directly is not allowed" The code triggering this is:
    configurations.getByName("jsMainImplementation").forEach { ... }
    My question is, what do I need to change this to for it to work with 1.3.30+?
    g
    • 2
    • 21
  • m

    miqbaldc

    08/02/2019, 2:04 AM
    what's the difference #gradle channel with #kotlin_dsl #dsl #kotlin-dsl?
    g
    • 2
    • 1
  • u

    ursus

    08/02/2019, 11:29 PM
    what do you mean
    unless all inputs and outputs are represented as a file
    ?
    t
    • 2
    • 1
  • b

    barteks2x

    08/03/2019, 10:01 PM
    I just realized I asked it in #intellij instead of #gradle
    How do I force intellij to refresh gradle buildSrc index so that it actually knows what changed in there?
    Usually I just mess around with the buildscript until a message pops up that buildscript dependencies have changed, then I restore everything to what it was and click "apply"
    (also I'm on gradle 4.8, so any gradle 5.x specific way won't work for me)
    l
    • 2
    • 1
  • b

    barteks2x

    08/03/2019, 10:11 PM
    thanks to intellij I'm almost completely stuck now
    s
    • 2
    • 37
  • b

    barteks2x

    08/03/2019, 10:21 PM
    All I want is a quick and reliable way to do this
    ➕ 1
    o
    • 2
    • 1
Powered by Linen
Title
b

barteks2x

08/03/2019, 10:21 PM
All I want is a quick and reliable way to do this
➕ 1
o

octylFractal

08/05/2019, 8:54 PM
in my experience refreshing the Gradle import works, I. e. going to the Gradle tab and sycing
View count: 3