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

    Big Chungus

    05/13/2021, 12:40 PM
    Given the folowing project layout, how do I invoke
    gradlew
    for the child module from child module's directory?
    /root/
      parent/
        gradlew
        build.gradle
        serrings.gradle
      child/
        build.gradle
      another-child/
        build.gradle
    I've tried this, but it errors while trying to evaluate child as parent
    #pwd: /root/child
    ../parent/gradlew help
    Here's the error
    FAILURE: Build failed with an exception.
    
    * Where:
    Build file '/root/child/build.gradle' line: 6
    
    * What went wrong:
    A problem occurred evaluating root project 'child'.
    > Project with path ':another-child' could not be found in root project 'child'.
    
    * 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
    I'm on Gradle 5.4.1
    t
    • 2
    • 4
  • g

    Giorgio Antonioli

    05/13/2021, 2:05 PM
    Hello, I upgraded the JDK from 1.8 to 11. Is there a way to use the 1.8 sources and compile towards 1.8? I’ve used
    kotlinOptions.jvmTarget = "1.8"
    but I can still access the JDK 11 classes. To make a clear example: the API
    AccessibleObject.isAccessible
    is deprecated since 9. I’d like to still use the source of 1.8 in which that API is not deprecated.
    m
    e
    i
    • 4
    • 13
  • m

    Marko Novakovic

    05/13/2021, 4:39 PM
    am using Kotlin Gradle DSL and am trying to extract local module dependencies into Kotlin 
    object
     and implement it in 
    build.gradle.kts
     like this:
    object Modules {
        val DependencyHandlerScope.initializer: ProjectDependency
            get() = project(":initializer")
    }
    and implementation
    dependencies {
        implementation(Modules.initializer)
    }
    but it’s not working, it tries to import 
    Modiles.initializer
    . is it possible to do it like am trying to?
    j
    • 2
    • 14
  • o

    oshai

    05/14/2021, 7:58 AM
    Can anyone recommend a good plugin + example to publish a lib to maven central (with gradle kts file)
    v
    j
    • 3
    • 7
  • b

    Big Chungus

    05/14/2021, 10:48 AM
    Not directly kotlin related, but thought it'd be useful to share. I've written few bash scripts that you could install in
    /usr/local/bin
    (or any other directory on
    $PATH
    ) to ease some pains when working on multi-module projects. It basically finds the nearest
    gradlew
    file to execute with, allowing you to run tasks via
    gradlew
    from any submodule. Helps a ton to make sure the team is building with the same exact gradle setup 😄
    r
    • 2
    • 3
  • e

    El Zhang

    05/14/2021, 1:09 PM
    Hi folks, I encountered an issue which is a bit weird: 1. This is quite a common scenario when you write a Gradle Plugin working with Android Gradle Plugin, it basically traverses all variants so that we can add some tasks based on variant settings:
    val appClassicExt = project.extensions.findByType(AppExtension::class.java)!!
    appClassicExt.applicationVariants.all { variant -> ... }
    2. The issues is the
    all
    function: • When I wrote it normally, it works perfectly, it calls the right
    all
    function which is
    org.gradle.api.DomainObjectCollection # void all(Action<? super T> action);
    • However when I worked with Kotlin std, it calls this one from Kotlin `_Collections.kt`:
    public inline fun <T> Iterable<T>.all(predicate: (T) -> Boolean): Boolean {
        if (this is Collection && isEmpty()) return true
        for (element in this) if (!predicate(element)) return false
        return true
    }
    So the traversal is not working anymore, may I know how to specifically make it call the one I want (The Gradle API)? Thanks.
    p
    v
    • 3
    • 6
  • s

    Shabinder Singh

    05/14/2021, 1:12 PM
    I am encountering following issue with gradle’s Signing Task: ` Exception is:`*
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':signReleasePublication'.
    Caused by: java.io.IOException: secret key ring doesn't start with secret key tag: tag 0x17
    Any help would be appreciated
    b
    c
    v
    • 4
    • 18
  • n

    nuhkoca

    05/18/2021, 9:21 AM
    Can anybody help me with this question on SO? Appreciate your help, thanks. https://stackoverflow.com/questions/67582914/how-to-convert-a-common-gradle-script-to-gradle-kotlin-dsl
    s
    m
    • 3
    • 18
  • i

    iamthevoid

    05/19/2021, 2:04 PM
    Anybody can say me why kotlin gradle api changes so rapidly? I ’ve created many cool extensions for avoid repeating code, but two last as-canary-fox updates breaks all. How can we write beauty and readable (and maintanable code) if update can break all into a little pieces? Why LibraryExtensions, ApplicationExtensions, TestedExtensions get 5 generic parameters? Why they move to another package? I don’t understand (((
    v
    n
    +3
    • 6
    • 5
  • s

    Shabinder Singh

    05/20/2021, 1:21 PM
    I have been getting some warning while building , however project is building fine and all, still wanted to see if this can be fixed: I am using :
    buildToolsVersion = "30.0.3"
    implementation("com.android.tools.build:gradle:4.1.1")
    n
    • 2
    • 3
  • e

    eygraber

    05/20/2021, 10:52 PM
    Is there a difference between:
    tasks.withType(KotlinJvmCompile::class).configureEach {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    
        kotlinOptions {
            jvmTarget = "11"
        }
    }
    and
    android {
      compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
      }
    
      kotlinOptions {
        jvmTarget = "11"
      }
    }
    when using the
    kotlin-android
    plugin?
    p
    t
    a
    • 4
    • 4
  • j

    Justin Tullgren

    05/21/2021, 4:41 PM
    anyone know why gradle tasks do not show up anymore in the gradle tab in intellij? The project is synced and running tasks manually works but now i can't browse.
    j
    • 2
    • 9
  • b

    Big Chungus

    05/21/2021, 6:10 PM
    What gradle task is intellij running on sync?
    n
    j
    +2
    • 5
    • 25
  • m

    magnumrocha

    05/21/2021, 6:42 PM
    does any one having this Issue?
    Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.5.0.
    Searched in the following locations:
      - <https://kotlin.bintray.com/kotlinx/org/jetbrains/kotlin/kotlin-scripting-compiler-embeddable/1.5.0/kotlin-scripting-compiler-embeddable-1.5.0.pom>
      - <https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-scripting-compiler-embeddable/1.5.0/kotlin-scripting-compiler-embeddable-1.5.0.pom>
    I’m trying to update my project to kotlin 1.5.0, and Coroutines module as well…..
    t
    • 2
    • 2
  • u

    ursus

    05/22/2021, 3:13 PM
    Will adding configuration cache help with AS sync time (when switching build variant from the ui)?
    p
    • 2
    • 6
  • s

    Slackbot

    05/22/2021, 4:13 PM
    This message was deleted.
    n
    g
    • 3
    • 2
  • g

    Gopal S Akshintala

    05/22/2021, 5:38 PM
    I am using 
    id("io.freefair.lombok") version "6.0.0-m2"
     plugin for lombok on gradle. I have a mix of Java and Kotlin. My plan is to delombok java code and use that while compiling kotlin code. I tried below, but Kotlin doesn’t pick-up delomboked classes. What am I missing?
    ourceSets.main {
        java.srcDirs("${project.buildDir}/generated/sources/delombok/java/main")
    }
    
    tasks {
        delombok {
            quiet.set(true)
        }
        compileKotlin {
            dependsOn(delombok)
            kotlinOptions {
                jvmTarget = JavaVersion.VERSION_11.toString()
            }
        }
    }
    n
    • 2
    • 19
  • e

    El Zhang

    05/23/2021, 3:16 AM
    1. Background: I have some Gradle custom plugins, and want to have a sample app to showcase all usage of them. Currently I use Gradle Kotlin DSL, and wish all
    *.gradle.kts
    are flexible to add/remove easily if developer wants. So I designed a arch like below diagram. 2. As we all know
    *.gradle.kts
    files can not place in the same place as
    build.gradle.kts
    and let
    build.gradle.kts
    apply it if we need to apply some plugins in this
    *.gradle.kts
    (while Groovy DSL works in this case), the common practice is move them to
    /buildSrc
    or a composite-build module, let say
    /build-env
    . a. If
    /buildSrc
    , seems it does not support
    include()
    includeBuild()
    to include plugin source modules b. if
    /build-env
    , I can refer plugin source via either
    include()
    or
    includeBuild()
    , however it does not have kotlin-dsl-accessors generated, so I can not use
    plugins{ id("slack")}
    with
    slackNotifyExt{ channel = "" }
    dsl extensions (but looks like apply<Plugin>() and configure<Ext>() works) I'm wondering what is the best practice for this scenario? Below is a simple diagram to show my proposal arch.
    v
    • 2
    • 13
  • g

    Gopal S Akshintala

    05/23/2021, 4:18 AM
    Hi Gradlers, Disclaimer: This is a gradle specific and not specific to lombok or Kotlin.This works with Maven but I am struggling how to achieve the same with Gradle (with my half-knowledge). How can I selectively provide sourceSets for lombok with
    src/main/java
    and Kotlin compiler with
    ${project.buildDir}/generated/sources/delombok/java/main
    ? Problem details and Use-case: I call Kotlin from Java and some Kotlin files use Java classes that are annotated with Lombok. So the idea is (which I followed in Maven as well) is to delombok first to generate sources -> then point Kotlin to use delombok generated sourceSets to prepare end results. The problem is, when I do this, it appends this sourceSets to
    src/main/java
    (which leads to compile failure)
    compileKotlin {
            dependsOn(delombok)
            sourceSets.main {
                java.srcDirs(“${project.buildDir}/generated/sources/delombok/java/main”)
            }
        }
    When I use
    setSrcDirs
    instead of
    srcDirs
    like below, lombok is not able to pick-up java files from
    src/main/java
    (this is strange as I only have set it up in
    compileKotlin
    and not top-level sourceSets)
    compileKotlin {
            dependsOn(delombok)
            sourceSets.main {
                java.setSrcDirs(listOf(“${project.buildDir}/generated/sources/delombok/java/main”))
            }
        }
    v
    • 2
    • 4
  • b

    Big Chungus

    05/23/2021, 2:37 PM
    Is it possible to apply different versions of kotlin plugin between gradle modules? E.g. kotlin 1.4 on root module, but kotlin 1.2 on root:child module?
    🤔 1
    j
    p
    • 3
    • 7
  • j

    janvladimirmostert

    05/23/2021, 6:01 PM
    Since upgrading from Gradle 6.8.3 to Gradle 7.0.2, my builds are failing with this message:
    Entry antlr/SQLLexer.g4 is a duplicate but no duplicate handling strategy has been set. Please refer to <https://docs.gradle.org/7.0.2/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy> for details.
    and it's failing on a different non-JVM file every time, sometimes a PNG, sometimes a ANTLR g4 file The link says I need to set the
    DuplicatesStrategy
    in the CopyPlugin, any idea what that means?
    v
    • 2
    • 2
  • x

    xxfast

    05/23/2021, 11:58 PM
    Is there a way to access
    buildSrc
    declarations within your app module?
    :not-kotlin: 1
    v
    • 2
    • 11
  • g

    Gopal S Akshintala

    05/24/2021, 6:33 AM
    How to add a generated directory to sourceSets, but make intellij to unmark as source root? I tried this but doesn’t work, I have to manual unmark the directory
    kotlin.sourceSets.main {
        kotlin.setSrcDirs(listOf(buildDir.resolve("generated/sources/delombok/java/main")))
    }
    
    idea {
        module {
            generatedSourceDirs.add(buildDir.resolve("generated/sources/delombok/java/main"))
            iml {
                whenMerged {
                    excludeDirs.add(buildDir.resolve("generated/sources/delombok/java/main"))
                }
            }
        }
    }
    a
    • 2
    • 3
  • i

    iamthevoid

    05/24/2021, 7:04 AM
    Why i can not access java.io.FileInputStream and java.util.Properties in
    buildSrc
    build.gradle.kts? Import directive and usage looks good (compiler do not warn) but when i try to build project i get many errors looks like build.gradle.kts of buildSrc failed to build
    e
    v
    • 3
    • 10
  • n

    nuhkoca

    05/24/2021, 3:06 PM
    I moved all plugin implementations(
    classpaths
    ) from root
    build.gradle.kts
    into
    buildSrc/build.gradle.kts
    but I am now getting weird warnings for some declarations as seen in the attachment. How can I get rid of this?
    j
    • 2
    • 13
  • d

    Dariusz Kuc

    05/25/2021, 9:32 PM
    Hello 👋 I'm occasionally hitting
    ClassNotFoundException
    during the build
    Caused by: java.lang.ClassNotFoundException: kotlinx.coroutines.CoroutinesInternalError
    Which generally implies some classpath issue. I'm using Gradle 6.8 with Kotlin 1.4.32 and coroutines 1.4.3. Wondering if anyone else encountered similar issue? While looking at the dependency tree (https://scans.gradle.com/s/uvf7bsxzvgwso/dependencies?dependencies=kotlinx-coroutines-core&amp;expandAll) the only config on
    kotlinx-coroutines-core
    is from the
    kotlinCompilerPluginClasspath
    . When I run
    gradle -q dependencies --configuration kotlinCompilerPluginClasspath
    you can see that it comes from
    kotlin-scripting-compiler-embeddable
    kotlinCompilerPluginClasspath
    \--- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.4.32
         +--- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.4.32
         |    +--- org.jetbrains.kotlin:kotlin-scripting-common:1.4.32
         |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32
         |    |    |    +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.32
         |    |    |    \--- org.jetbrains:annotations:13.0
         |    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8
         |    |         +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.71 -> 1.4.32 (*)
         |    |         \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.71 -> 1.4.32
         |    +--- org.jetbrains.kotlin:kotlin-scripting-jvm:1.4.32
         |    |    +--- org.jetbrains.kotlin:kotlin-script-runtime:1.4.32
         |    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)
         |    |    \--- org.jetbrains.kotlin:kotlin-scripting-common:1.4.32 (*)
         |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)
         |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8 (*)
         \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.32 (*)
    
    (*) - dependencies omitted (listed previously)
    and sure enough the published artifact references old version of coroutines -> https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-scripting-compiler-impl-e[…]e/1.4.32/kotlin-scripting-compiler-impl-embeddable-1.4.32.pom (release 1.5.10 still points to 1.3.8 coroutines as well). Any ideas why runtime dep would be blowing stuff up?
    n
    • 2
    • 19
  • u

    ubu

    05/26/2021, 10:44 AM
    Hello guys! I have an
    .aar
    library, which is located on the project level:
    libs/lib.aar
    . I declare it in an Android Library module in the following manner:
    implementation files('libs/lib.aar')
    After updating to the latest Android Gradle Plugin:
    -classpath 'com.android.tools.build:gradle:3.5.3'
     +classpath 'com.android.tools.build:gradle:7.0.0-beta02'
    I got this error message:
    Direct local .aar file dependencies are not supported when building an AAR. The resulting AAR would be broken because the classes and Android resources from any local .aar file dependencies would not be packaged in the resulting AAR. Previous versions of the Android Gradle Plugin produce broken AARs in this case too (despite not throwing this error)
    The only thing I could find on Stackoverflow was the following: https://stackoverflow.com/questions/60878599/error-building-android-library-direct-local-aar-file-dependencies-are-not-supp But these solutions seem outdated. Following official documentation here didn’t help either. Did someone encounter this issue? Need help! 🆘
    p
    n
    e
    • 4
    • 24
  • r

    rnett

    05/27/2021, 5:42 AM
    Trying to work around the above, is there a way to get a runtime classpath of a Kotlin/JVM source set without
    withJava()
    ?
    configurations["jvmRuntimeClasspath"]
    results in
    ClassNotFound
    errors
    a
    • 2
    • 2
  • s

    Sourabh Rawat

    05/27/2021, 9:03 AM
    Hi is it possible to depend on test sourceset of a module using
    TYPESAFE_PROJECT_ACCESSORS
    ?
    v
    • 2
    • 2
  • n

    nikolaymetchev

    05/27/2021, 9:36 AM
    Hi, It seems that google announced kotlin support for protobuf at IO. I can’t seem to find if this is supported in the Gradle protobuf plugin yet. I suspect not. Anybody know anything?
    c
    • 2
    • 3
Powered by Linen
Title
n

nikolaymetchev

05/27/2021, 9:36 AM
Hi, It seems that google announced kotlin support for protobuf at IO. I can’t seem to find if this is supported in the Gradle protobuf plugin yet. I suspect not. Anybody know anything?
c

Chris Miller

05/28/2021, 3:10 PM
The Kotlin support in protobuf isn't quite released yet, let alone the Gradle plugin. Should be in the next protobuf version: https://github.com/protocolbuffers/protobuf/tree/v3.17.0/java#kotlin-protocol-buffers
n

nikolaymetchev

05/28/2021, 4:05 PM
Well, hello there Chris! It turns out that it is possible to get it working already! I asked in the Gradle slack channel https://gradle-community.slack.com/archives/CA7UM03V3/p1622108175111100
TLDR;
task.plugins {
    kotlin {
      outputSubDir = 'kotlin'
    }
  }
And add
protobuf-kotlin
to your classpath and you are good to go!
View count: 5