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

    x80486

    12/13/2017, 3:44 PM
    Yeah, I'm retarded...I was just using
    1.2
    (without the
    .0
    in the end)
    c
    • 2
    • 1
  • m

    mkobit

    12/13/2017, 3:44 PM
    you can use the
    pluginManagement
    dsl if you want to use JUnit 5 plugin in the
    plugins {}
    block - see https://github.com/junit-team/junit5/issues/768#issuecomment-330078905 for that
    ➕ 2
    c
    • 2
    • 1
  • k

    kartikpatodi

    12/13/2017, 3:49 PM
    how?
    m
    • 2
    • 11
  • k

    kartikpatodi

    12/13/2017, 5:12 PM
    will this cover compileTestKotlin as well?
    :yes: 3
    c
    • 2
    • 1
  • m

    mkobit

    12/13/2017, 6:58 PM
    has anybody else ran into publishing a library depending on kotlin, not including the version in the POM? so like
    api(kotlin("stdlib-jre8"))
    and running
    ./gradlew genPom
    with the
    maven-publish
    plugin and getting a dependency without the version?
    <dependency>
          <groupId>org.jetbrains.kotlin</groupId>
          <artifactId>kotlin-stdlib-jre8</artifactId>
          <scope>compile</scope>
        </dependency>
    g
    c
    i
    • 4
    • 14
  • d

    Dmitry Kandalov

    12/13/2017, 11:00 PM
    Hi. How can I write the following in
    build.gradle.kts
    ?
    sourceSets {
        main {
            java { srcDir "./src" }
            kotlin { srcDir "./src" }
            resources { srcDir "./resources" }
        }
        test {
            kotlin { srcDir "./test" }
        }
    }
    i
    g
    • 3
    • 13
  • m

    Marcel Overdijk

    12/14/2017, 5:31 PM
    In Groovy
    build.gradle
    I typically define (reusable) ext properties in my build scripts like:
    buildscript {
        ext {
            javaVersion                     = "1.8"
            kotlinVersion                   = "1.2.0"
            springBootVesion                = "2.0.0.M7"
            querydslVersion                 = "4.1.4"
            querydslGradlePluginVersion     = "1.0.8"
        }
    And the I can refer to these properties when declaring plugins and dependencies. What is the proper way to this within Kotlin DSL?
    b
    c
    e
    • 4
    • 8
  • b

    bamboo

    12/14/2017, 6:18 PM
    there’s a known issue about IntelliJ not using the right version of the Gradle wrapper with
    buildSrc
    g
    • 2
    • 2
  • n

    nikolaymetchev

    12/14/2017, 8:53 PM
    Has anyone tried the ivypot gradle plugin? https://github.com/ysb33r/ivypot-gradle-plugin I am getting the following error when I try and sync repos:
    module not found: org.jetbrains.kotlin#kotlin-stdlib;${kotlin.version}
    e
    • 2
    • 3
  • l

    lukas

    12/15/2017, 7:50 AM
    Hi guys, quick question - is there anything like
    gradle.ext
    that I can use to make values from settings.gradle.kts available to build.gradle.kts?
    c
    r
    • 3
    • 11
  • a

    anstaendig

    12/16/2017, 11:20 AM
    nope, none of it works.
    c
    • 2
    • 1
  • a

    araqnid

    12/19/2017, 2:21 AM
    I can do it this reasonably terrible way, of course, by insert this into
    settings.gradle.kts
    operator fun Settings.get(key: String): String {
                return javaClass.getMethod("getProperty", String::class.java).invoke(this, key) as String
            }
    and then referring to
    settings["property"]
    for example
    c
    • 2
    • 6
  • l

    lukas

    12/19/2017, 9:26 AM
    Hey guys, how can I access / set
    archivesBaseName
    ? I saw some scripts using
    base { archivesBaseName = ".." }
    but can’t get that work.. always get the following compile error - even though it get’s recognized and resolved in the editor in IntelliJ
    Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
    public val PluginDependenciesSpec.base: PluginDependencySpec defined in org.gradle.kotlin.dsl
    c
    e
    • 3
    • 5
  • m

    mkobit

    12/20/2017, 2:58 PM
    @kartikpatodi im not following - what are you trying to do?
    k
    • 2
    • 4
  • c

    carrot

    12/20/2017, 6:12 PM
    classpath("javax.xml.bind:jaxb-api:2.3.0")
    this in my buildscript dependencies worked
    c
    • 2
    • 1
  • x

    xenoterracide

    12/21/2017, 3:24 AM
    is this the best way to have written this?
    g
    • 2
    • 58
  • x

    xenoterracide

    12/21/2017, 5:24 AM
    checkstyle {
        toolVersion = "8.4"
        sourceSets.forEach( { println(it) })
        sourceSets.removeIf( { it.name == "test" })
    }
    g
    • 2
    • 2
  • x

    xenoterracide

    12/21/2017, 6:54 AM
    last question for the night, I hope. anyone have any idea's about this problem? https://stackoverflow.com/q/47880167/206466
    g
    • 2
    • 47
  • x

    xenoterracide

    12/21/2017, 7:54 AM
    I said I was done, but is there any chance that this is a bug in the dsl? using groovy I could just pass a string, and that could be null as long as I wasn't trying to publish
    publishing {
        repositories {
            maven {
                url = uri(System.getenv("JRS_S3_URI") ?: "" )
    g
    • 2
    • 26
  • x

    xenoterracide

    12/21/2017, 8:28 AM
    @gildor can't figure out how to upload a file in a thread apparently
    g
    • 2
    • 1
  • x

    xenoterracide

    12/21/2017, 9:08 AM
    well the difference in groovy I think is that groovy somehow is evaluating it later, somehow it's much more eagerly evaluated by kotlin instead of only being evaluated when I do a
    gradle publish
    g
    • 2
    • 5
  • x

    xenoterracide

    12/21/2017, 9:12 AM
    btw, I noticed the README.md says you can't use kotlin for gradle.settings, but the sample's all do
    g
    • 2
    • 5
  • x

    xenoterracide

    12/21/2017, 10:46 AM
    I mean I understand the warning, I guess I don't understand why there's a duplicate
    c
    • 2
    • 20
  • x

    xenoterracide

    12/21/2017, 11:50 AM
    well I'd love to leave the if statements out
    c
    • 2
    • 11
  • t

    trubesv

    12/21/2017, 2:28 PM
    Hi all 🙂 Has anyone had success with setting up Travis CI (GitHub) with Gradle (Kotlin DSL) for OpenJDK9? I can't find any example repo.. Thanks!
    b
    • 2
    • 1
  • a

    araqnid

    12/21/2017, 2:38 PM
    it just works as normal if you have
    language: java
    set in the control file and a Gradle wrapper to specify a recent Gradle version (e.g. https://travis-ci.org/araqnid/fuel-log runs on 8 and 9)
    t
    • 2
    • 1
  • m

    Marcel Overdijk

    12/22/2017, 9:48 AM
    or is there a cleaner approach with kotlin dsl?
    g
    b
    • 3
    • 6
  • x

    xenoterracide

    12/22/2017, 2:35 PM
    can someone explain
    System.getenv("JRS_S3_URI")?.let {
        val sourcesJar by tasks.creating(Jar::class) {
            classifier = "sources"
            from(java.sourceSets["main"].allSource)
        }
    
        publishing {
            repositories {
                maven {
                    url = uri(it)
                    credentials(AwsCredentials::class.java) {
                        accessKey = System.getenv("JRS_ACCESSKEYID")
                        secretKey = System.getenv("JRS_SECRETACCESSKEY")
                    }
                }
            }
            (publications) {
                "mavenJava"(MavenPublication::class) {
                    from(components["java"])
                    artifact(sourcesJar)
                }
            }
        }
    }
    from the gradle version? I don't get why it's
    AwsCredentials::class.java
    or even what the java is at all, or why publications is
    (publications) {
    "mavenJava"(MavenPublication::class) {
    like literally If I hadn't copied it, I would never have figured it out from what I had
    e
    • 2
    • 2
  • x

    xenoterracide

    12/22/2017, 2:43 PM
    and on a non kotlin specific note, anyone know if there's a good way to compare a before and after classpath with gradle. had a problem that turned out to be the classpath, and I figured out which dependency 'caused the issue, but since that dep is basically exporting transitives, and I'm not sure which might have been missing...
    e
    • 2
    • 1
  • x

    xenoterracide

    12/23/2017, 8:17 AM
    what's the equivalent of this in kotlin
    configurations { driver }
    
    dependencies { driver 'org.xerial:sqlite-jdbc:3.7.2' }`
    e
    • 2
    • 1
Powered by Linen
Title
x

xenoterracide

12/23/2017, 8:17 AM
what's the equivalent of this in kotlin
configurations { driver }

dependencies { driver 'org.xerial:sqlite-jdbc:3.7.2' }`
e

eskatos

12/23/2017, 12:38 PM
Mechanically translated, string based:
configurations { "driver"() }
dependencies { "driver"("org.xerial:sqlite-jdbc:3.7.2")}
Making it type safe:
val driver = configurations.create("driver")
dependencies { driver("org.xerial:sqlite-jdbc:3.7.2")}
Which can be also expressed as:
val driver by configurations.creating
dependencies { driver("org.xerial:sqlite-jdbc:3.7.2")}
View count: 1