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

    Smallville7123

    04/12/2019, 7:16 AM
    how do i achive the same result with kotlin
    multiplatform
    g
    • 2
    • 1
  • s

    Smallville7123

    04/12/2019, 7:55 AM
    why is this so difficult to get set up correctly so i can find memory leaks in my plugin ;-;
    g
    • 2
    • 1
  • d

    dwursteisen

    04/12/2019, 2:27 PM
    👋 Quick question: I’m trying to build a jar with all dependencies of my gradle project. So I create a
    Jar
    task that will use all dependencies :
    val dist = project.tasks.create("dist", Jar::class.java) {
         from(configurations.runtime.map { if (it.isDirectory) it else zipTree(it) })
    }
    But I got an error:
    from(configurations.runtime.map { if (it.isDirectory) it else zipTree(it) })
                                                           ^ Unresolved reference: isDirectory
    If I’m printing the configuration (
    println(configurations.runtime.javaClass)
    ), I got that:
    class org.gradle.api.internal.DefaultNamedDomainObjectCollection$ExistingNamedDomainObjectProvider_Decorated
    I would expect something like
    FileCollection
    or
    Configuration
    . What I’m doing wrong? 🤔
    s
    • 2
    • 3
  • i

    Icaro Temponi

    04/12/2019, 5:37 PM
    Hi everyone. How can I make a plugin visible to the buildSrc module? already tried to add it as a dependency on the build file: implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:$bintrayPluginVersion") also tried to apply the plugin using the plugins block, but still wasn't able to create an extension on the BintrayExtension class (class added by the plugin)
    t
    • 2
    • 2
  • h

    hmole

    04/13/2019, 6:29 AM
    What's the solution for sharing dependency notations/versions in a typesafe way across different scripts of multimodule
    buildSrc
    ? I tried putting
    buildSrc
    in my
    buildSrc
    🤯 but sadly it didn't work.
    g
    • 2
    • 22
  • s

    Smallville7123

    04/14/2019, 4:52 AM
    does gradle cache plugin data
    :google: 1
    g
    • 2
    • 1
  • s

    Smallville7123

    04/14/2019, 10:31 AM
    why is gradle using 3.0GB
    :thread-please: 2
    n
    • 2
    • 4
  • i

    Imran/Malic

    04/16/2019, 6:19 PM
    How do I create and run jar files in kotlin
    c
    c
    s
    • 4
    • 19
  • i

    Imran/Malic

    04/17/2019, 9:48 AM
    How to add classpath of gradle dependencies to the jar file
    o
    • 2
    • 4
  • p

    Paul Woitaschek

    04/17/2019, 9:51 AM
    Is there a better way than this for configuring the defaults for the kapt plugin and the android extensions for all modules?
    -.kt
    o
    • 2
    • 5
  • n

    Nezteb

    04/19/2019, 1:53 AM
    What are people’s favorite Gradle tutorials these days? I come from a Maven background.
    s
    n
    • 3
    • 5
  • s

    Slackbot

    04/19/2019, 2:56 PM
    This message was deleted.
    c
    • 2
    • 1
  • s

    Smallville7123

    04/19/2019, 4:29 PM
    how do i enable kotlin-DSL in a multi platform project as i get
    e: /home/macropreprocessor/IdeaProjects/kpp/buildSrc/src/main/kotlin/directoryembedder.gradle.kts: (1, 1): Unresolved reference: tasks
    /home/macropreprocessor/IdeaProjects/kpp/buildSrc/src/main/kotlin/directoryembedder.gradle.kts: (1, 1): Cannot access script base class 'kotlin.script.templates.standard.ScriptTemplateWithArgs'. Check your module classpath for missing or conflicting dependencies
    tasks {
        register("directoryEmbedder") {
            group = "Directory Embedder"
            description = "Directory Embedder"
            doLast {
                println("hello from Directory Embedder")
            }
        }
    }
    s
    g
    • 3
    • 3
  • s

    Smallville7123

    04/19/2019, 4:30 PM
    this is my
    buildSrc/build.gradle.kts
    plugins {
        `kotlin-dsl`
        `java-library`
    }
    
    repositories {
        jcenter()
    }
    g
    • 2
    • 3
  • s

    Smallville7123

    04/20/2019, 10:42 AM
    searches
    kotlin find gradle root without using gradle
    and first result is
    <https://kotlinlang.org/docs/reference/using-gradle.html>
    -_-
    g
    • 2
    • 4
  • s

    Smallville7123

    04/20/2019, 11:24 AM
    i want to aquire the project root from a kotlin module
    n
    • 2
    • 2
  • s

    Smallville7123

    04/20/2019, 6:11 PM
    basically the module acts like a code generator for my main module
    ❓ 1
    n
    • 2
    • 4
  • n

    Nezteb

    04/21/2019, 4:05 AM
    Is the Kotlin DSL for gradle “up to snuff” compared to the Groovy one?
    g
    • 2
    • 3
  • s

    Smallville7123

    04/21/2019, 2:04 PM
    12:03:50 AM: Executing task 'runReleaseExecutableLinux'...
    
    
    > Configure project :
    Kotlin Multiplatform Projects are an experimental feature.
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Script '/home/macropreprocessor/IdeaProjects/kpp/pack.kts' line: 6
    
    * What went wrong:
    A problem occurred evaluating script.
    > Could not find method recDir() for arguments [{current=class java.io.File}, pack_6jwbnzhp0j5onxijf2qveb5gr$_run_closure2@78e7a62e] on root project 'kpp' of type org.gradle.api.Project.
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Get more help at <https://help.gradle.org>
    
    BUILD FAILED in 0s
    Could not find method recDir() for arguments [{current=class java.io.File}, pack_6jwbnzhp0j5onxijf2qveb5gr$_run_closure2@78e7a62e] on root project 'kpp' of type org.gradle.api.Project.
    12:03:50 AM: Task execution finished 'runReleaseExecutableLinux'.
    pack_kts.kt
    e
    g
    i
    • 4
    • 5
  • n

    Nezteb

    04/21/2019, 5:41 PM
    here’s what i ended up with. turns out i don’t even need
    buildscript
    👍 4
    s
    • 2
    • 1
  • r

    rook

    04/22/2019, 4:42 PM
    I’m trying to get my unit tests running from the command line. For unit testing purposes, I need the sources in
    src/test/java/
    ,
    src/mock/java
    , and
    src/main/java
    . When I add these sources to the
    test
    source set and run
    ./gradlew test -i
    from the command line, I don’t see any test results at all.
    sourceSets.forEach {
        if(it.name.contains("test")) {
            it.java.srcDirs("src/test/java/", "src/mock/java")
        }
        it.java.srcDirs("src/${it.name}/java")
    }
    Is there something else I should be doing to ensure that my tests actually run?
    g
    • 2
    • 44
  • r

    ralf

    04/22/2019, 6:09 PM
    I know it sounds gross, but is there a way to teach Kotlin that a different Gradle module is my “friend” and I want to see its internal code? I’m referring to the
    friend-path
    Kotlin compiler argument.
    o
    • 2
    • 2
  • s

    sbyrne

    04/23/2019, 1:01 AM
    I am trying to make a simple project that just has
    build.gradle.kts
    and
    MyClass.kt
    in the project dir.
    build.gradle.kts
    has
    sourceSets { main { java { setSrcDirs(listOf(".")); exclude( "*.kts" ) } } }
    . All works from from command line, but Idea doesn't pick up the project dir as a source dir, and doesn't do code completion in
    MyClass.kt
    .
    a
    • 2
    • 1
  • a

    altavir

    04/23/2019, 7:11 PM
    @gildor I am moving discussion to appropriate channel. I've applied your patches, and it seems to be working, but the build speed dropped dramatically. If I won't find a way to fix it, I will have to move back to one-file configuration.
    g
    • 2
    • 83
  • b

    BreadMoirai

    04/24/2019, 1:29 AM
    I'm trying to set the kotlin compile src to a different directory that i use to replace tokens in the source code. With the above code, it just adds the copied directory as additional sources and i get re-declaration errors. What is the correct approach to this?
    build_gradle_kts.kt
    g
    • 2
    • 2
  • j

    janvladimirmostert

    04/24/2019, 8:32 AM
    is there a way to specify how much memory the kotlin compiler should use in the KotlinCompile block?
    tasks.withType<KotlinCompile> {
    	incremental = true
    	kotlinOptions.jvmTarget = "1.8"
    }
    builds that usually took 1 minute are now taking 7-15 minutes, not sure if it's due to the code-base growing pass a certain point that's now causing this slowdown, new intellij version, new kotlin version or any of several dozen permutations of things that could have changed. i want to see if giving the compiler more memory will speed up compile times or get it back to "normal"
    g
    s
    • 3
    • 76
  • j

    janvladimirmostert

    04/24/2019, 8:27 PM
    how does one configure the JPA plugin in gradle kotlin dsl ? The no-arg plugin and jpa plugin is applied like this:
    plugins {
        id("org.jetbrains.kotlin.plugin.noarg").version(kotlinVersion)
        id("org.jetbrains.kotlin.plugin.jpa").version(kotlinVersion)
    }
    and then the noArg one i figured out can be configured like this
    noArg {
    	annotation(...)
    }
    how does one do that for the jpa plugin? I'm trying to translate this maven to gradle kotlin dsl:
    <configuration>
                        <jvmTarget>${java.version}</jvmTarget>
                        <compilerPlugins>
                            <plugin>jpa</plugin>
                        </compilerPlugins>
                        <pluginOptions>
                            <option>jpa:annotation=javax.persistence.MappedSuperclass</option>
                        </pluginOptions>
                    </configuration>
    s
    c
    • 3
    • 5
  • s

    snowe

    04/24/2019, 9:33 PM
    It seems like it has significant downsides. But using delegated properties isn't really clean either.
    c
    g
    • 3
    • 26
  • h

    henrik

    04/25/2019, 8:12 AM
    I'm looking at forking the
    kotlin-allopen
    gradle plugin (into a separate repo), but I'm having some early problems:
    Plugin with id 'jps-compatible' not found.
    . I haven't been able to find a repo where that plugin is published, do any of you guys know?
    o
    • 2
    • 2
  • h

    henrik

    04/25/2019, 1:32 PM
    Does anyone know why I'm getting an UnknownPluginException when trying to use a custom-built gradle kotlin compiler plugin? Here are the details: https://stackoverflow.com/questions/55850500/why-do-i-get-unknownpluginexception-when-trying-to-use-a-custom-kotlin-complier
    s
    • 2
    • 13
Powered by Linen
Title
h

henrik

04/25/2019, 1:32 PM
Does anyone know why I'm getting an UnknownPluginException when trying to use a custom-built gradle kotlin compiler plugin? Here are the details: https://stackoverflow.com/questions/55850500/why-do-i-get-unknownpluginexception-when-trying-to-use-a-custom-kotlin-complier
s

snowe

04/25/2019, 8:44 PM
responded on stack overflow, but where do you have it deployed? did you deploy to
mavenLocal()
? did you deploy at all? have you made sure that you set up to search mavenLocal for plugins?
h

henrik

04/26/2019, 4:59 AM
I deployed it to mavenLocal. I know Gradle finds it, because it fails earlier if I insert a typo in the classpath dependency.
@snowe I have added an example project now, so it's really easy to reproduce. Feel like taking a look? 🙂
(just read the "Work in progress" at https://github.com/henrik242/kotlin-really-allopen/blob/master/README.md )
s

snowe

04/26/2019, 3:07 PM
let me look.
https://github.com/henrik242/kotlin-really-allopen/pull/1
you didn't update the plugin repositories.
also, you will need to comment out your plugin in
example
until you publish the
plugin
module to
mavenLocal
. then you can uncomment it.
you still have test failures, but you are at least past the problem you were having.
sorry it took so long. I was helping other coworkers.
h

henrik

05/02/2019, 10:45 AM
Hehe, no problem 🙂
I did uncomment (had to do the same with the
buildscript
version)
Anyway, I solved it better by using
GradleRunner
🙂
View count: 3