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

    apomelov

    11/09/2017, 8:57 AM
    Hi. It seems I've already gotten answer for this newbie question but it's already behind the time horizon, I can't find it. What is the proper way to access existing tasks for configuring them? For example I want to add a spring profile when running application via gradle. Now I'm doing it like this:
    val run: JavaExec by tasks
    run.systemProperties["spring.profiles.active"] = "dev"
    Second line is ok, but the first one looks like get any Task from map by name and cast it to JavaExec. Where is my strict typed model?) Or I want to run coberturaReport prior to test:
    val test by tasks
    val coberturaReport by tasks
    test.dependsOn(coberturaReport)
    Ok, no casts but still getting tasks from map by name.
    c
    • 2
    • 5
  • m

    Marcel Overdijk

    11/11/2017, 11:55 AM
    plugins {
        id "org.gradle.kotlin.kotlin-dsl" version "0.12.0"
    }
    c
    • 2
    • 1
  • m

    mikehearn

    11/11/2017, 6:27 PM
    anyone know how IntelliJ decides that a kotlin gradle file is meant to be interpreted in the right way?
    b
    • 2
    • 1
  • c

    Czar

    11/12/2017, 8:49 PM
    I've filed an issue and included a demo project: https://github.com/gradle/kotlin-dsl/issues/590
    b
    • 2
    • 11
  • t

    thewoolleyman

    11/14/2017, 5:21 AM
    And why isn't there a 'jar' plugin provided by default, when there is a 'war' one?
    g
    • 2
    • 2
  • g

    gildor

    11/14/2017, 6:46 AM
    Why do not use shadow gradle plugin? https://github.com/johnrengelman/shadow
    ➕ 1
    t
    n
    • 3
    • 6
  • l

    lewis

    11/15/2017, 9:18 AM
    Hey, if I've created a custom sourceSet, how can I access that sourceSets configurations?
    m
    • 2
    • 1
  • b

    BorzdeG

    11/15/2017, 9:21 AM
    How it is correct to use
    kotlinVersion
    in the section
    plugins
    ?
    val kotlinVersion: String by extra
    
    plugins {
        kotlin("jvm") version kotlinVersion
    }
    Unresolved reference: kotlinVersion
    g
    c
    • 3
    • 2
  • t

    thewoolleyman

    11/16/2017, 9:44 AM
    Are there any known problems using kotlin 4.3 with gradle kotlin-dsl in intellij? Whenever I try it fails to recognize kotlin syntax in my sub-application build.gradle.kts, but it works fine with 4.2.
    j
    • 2
    • 1
  • j

    jlleitschuh

    11/16/2017, 3:57 PM
    @bamboo @eskatos Have either of you had a chance to look at my two PR's?
    e
    • 2
    • 2
  • m

    mkobit

    11/16/2017, 9:00 PM
    @x80486 what isnt working?
    x
    • 2
    • 2
  • l

    Lucas

    11/17/2017, 2:19 AM
    @x80486 Try
    project.property("artUser")
    . For example:
    gradle.properties
    artUser=john
    build.gradle.kts
    val sayUser by tasks.creating {
        doLast {
            println(project.property("artUser")) // john
        }
    }
    👏 1
    x
    • 2
    • 1
  • h

    holgerbrandl

    11/17/2017, 9:39 AM
    Is there a way to exclude kts files from a build. By default gradle fails with a
    java.lang.RuntimeException: Primary constructor not found for script template class ScriptTemplateWithArgs (not found)
    	at org.jetbrains.kotlin.codegen.ScriptCodegen.genConstructor(ScriptCodegen.java:161)
    	at org.jetbrains.kotlin.codegen.ScriptCodegen.generateBody(ScriptCodegen.java:103)
    if there’s a kts file sitting somewhere in the source roots.
    l
    • 2
    • 2
  • c

    christianbecker

    11/19/2017, 4:24 PM
    Hey, if I'm having issues with the Kotlin DSL in an Android project, there should I post this issue? Right in this channel?
    m
    • 2
    • 2
  • c

    christianbecker

    11/19/2017, 4:36 PM
    To be more precise, I'm having troubles using / applying the variantFilter (https://google.github.io/android-gradle-dsl/current/com.android.build.api.variant.VariantFilter.html) and the outputFileName (https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_output) with the latest Gradle.
    • 1
    • 1
  • c

    carolos

    11/20/2017, 1:32 PM
    hi there I am trying to use the gradle kotlin dsl and define properties in the following way:
    var kotlin_version by extra { "1.1.60" }
    and I am getting an unresolved reference 😞 even though I have seen some examples that do that instead I have to do this:
    var kotlin_version: String by extra
    kotlin_version = "1.1.60"
    am I doing something wrong?
    c
    • 2
    • 2
  • j

    jlleitschuh

    11/20/2017, 2:13 PM
    @bamboo or @eskatos Can one of you explain what the issue with Kotlin 1.6 is. I'm not really certain that I understand from the issues that I've read. I've just been seeing a bunch of reverts.
    b
    • 2
    • 5
  • c

    carolos

    11/20/2017, 5:11 PM
    I am using the gradle kotlin dsl - my tests are not being found when I run
    gradle test
    I am using JUnit 5. Is JUnit 5 supported? Any idea what I need to make it detect my tests?
    m
    • 2
    • 1
  • u

    user

    11/20/2017, 5:44 PM
    0.13.1 Gradle Kotlin DSL 0.13.1 Release Notes Gradle Kotlin DSL v0.13.1 brings support for settings.gradle.kts files, Kotlin standard library extensions to the Java 7 and Java 8 APIs for use in build scripts, improvements to the plugins {} DSL, and more! v0.13.1 is included in Gradle 4.4 RC1. The features in this release are also available for immediate use within the latest Gradle Kotlin DSL distribution snapshot. To use it, upgrade your Gradle wrapper in the following fashion: $ cd...
    🎉 6
    m
    b
    • 2
    • 2
  • c

    Czar

    11/20/2017, 6:56 PM
    what are the
    plugins {}
    improvements?
    b
    • 2
    • 2
  • u

    user

    11/20/2017, 8:04 PM
    0.13.1 Gradle Kotlin DSL 0.13.1 Release Notes Gradle Kotlin DSL v0.13.1 brings support for settings.gradle.kts files, Kotlin standard library extensions to the Java 7 and Java 8 APIs for use in build scripts, improvements to the plugins {} DSL, and more! v0.13.1 is included in Gradle 4.4 RC1. The features in this release are also available for immediate use within the latest Gradle Kotlin DSL distribution snapshot. To use it, upgrade your Gradle wrapper in the following fashion: $ cd...
    c
    • 1
    • 1
  • c

    Czar

    11/21/2017, 11:21 AM
    Hm... I see that https://github.com/gradle/kotlin-dsl/issues/337 is closed but
    api
    in
    dependencies {
        api(...)
    }
    is still not being resolved, strange because
    implementation(...)
    is and works.
    e
    • 2
    • 21
  • t

    tapchicoma

    11/22/2017, 8:39 AM
    hi, does kotlin support gradle build caching?
    e
    • 2
    • 2
  • e

    eskatos

    11/22/2017, 8:44 AM
    @Czar this should work Today, this issue is about adding the proper overloads to Gradle proper but
    kotlin-dsl
    includes extensions to work around the missing overloads upstream I just tried locally and it worked, what is not working exactly?
    c
    • 2
    • 6
  • l

    lewis

    11/22/2017, 9:51 AM
    Hi, IntelliJ frequently stops recognising my build.gradle.kts file, showing every line as an error. What magic do I have to do to stop that from happening?
    • 1
    • 1
  • b

    bamboo

    11/23/2017, 7:03 PM
    I think one of these plugins is explicitly changing the
    compile(kotlin("stdlib"))
    dependency version to match what they find in the build environment (which is wrong)
    c
    m
    • 3
    • 8
  • e

    Eugen Martynov

    11/23/2017, 8:11 PM
    I never had it green in any IDE that I have: Android Studio 3.0, Android Studio 3.1 Canary, IDEA ultimate stable 2017.2.6, IDEA community edition 2017.3 EAP
    n
    e
    • 3
    • 9
  • c

    Carsten L

    11/24/2017, 9:33 AM
    Hey everyone. Maybe someone could give a little help. What is the right way to use
    DomainObjectCollection.withType
    in Kotlin DSL? my example when writing a Plugin :
    project.run {
        repositories.withType(MavenArtifactRepository::class.java) {
            // I want to access the typed repo
            dostuff( this)
        }
    }
    what Building gives me: Error:(22, 44) Kotlin: Type mismatch: inferred type is Project but MavenArtifactRepository was expected I tried
    this@withType
    but that just yields: ‘this’ is not defined in this context. Can anyone hint me how to do this?
    c
    • 2
    • 3
  • a

    apomelov

    11/24/2017, 1:46 PM
    Hi. I've tried to use the
    org.hidetake.ssh
    plugin and caught "Failed to compile accessors" after add it to
    plugin {  }
    section. Tried to google for it, found this issue: https://github.com/gradle/kotlin-dsl/issues/447, but not sure it is my case. Any ideas to work this around?
    b
    • 2
    • 4
  • v

    velikodniy

    11/24/2017, 2:29 PM
    Hi. I know that is not actual kotlin question. I'm moving to project to Kotlin+gradle and have now instrumentation task with more than one classpass. How can I make this task in gradle?
    m
    • 2
    • 1
Powered by Linen
Title
v

velikodniy

11/24/2017, 2:29 PM
Hi. I know that is not actual kotlin question. I'm moving to project to Kotlin+gradle and have now instrumentation task with more than one classpass. How can I make this task in gradle?
m

mkobit

11/24/2017, 5:52 PM
IMO it is better to write a question like this on stack overflow
View count: 1