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

    jeggy

    02/24/2021, 7:16 PM
    Is there any best practises to share jacoco configuration between subprojects via kotlin gradle script?
    h
    j
    v
    • 4
    • 21
  • s

    scirner

    02/24/2021, 11:08 PM
    I had to add all my custom kotlin gradle plugin tasks inside the
    project.afterEvaluate
    closure due to how it depends on some subprojects being fully evaluated. How do you get the
    org.gradle.testfixtures.ProjectBuilder
    to force that evaluation? After adding that closure I can no longer see those tasks in my unit tests.
    • 1
    • 1
  • r

    Robert

    02/25/2021, 9:10 AM
    Anyone ever deployed to Heroku with a build.gradle.kts file and without gradlew? I get this error when pushing to heroku
    Could not find a 'gradlew' script or a 'build.gradle' file! Please check that they exist and are commited to Git.
    which is correct, because I use
    build.gradle.kts
    (with .kts). This is also in the documentation (https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku) but that would mean I HAVE to use
    gradlew
    instead of the wrapper task in gradle?
    v
    • 2
    • 5
  • k

    Karlo Lozovina

    02/25/2021, 8:34 PM
    how can I add dependencies (using Kotlin DSL) to a custom sourceSet? for example, here are my sourceSets:
    sourceSets {
        main {
            java.srcDir("main")
        }
        test {
            java.srcDir("test")
        }
        create("jmh") {
            java.srcDir("jmh")
        }
    }
    and the problem is that inside the "jmh" sourceSet I can't import my main classes...
    b
    • 2
    • 14
  • t

    tylerwilson

    02/26/2021, 2:15 PM
    I have this plugins block in my build.gradle.kts for my KMP module:
    plugins {
        id("com.android.library")
        kotlin("multiplatform")
        kotlin("native.cocoapods")
        kotlin("plugin.serialization") version "1.4.30"
        id("com.chromaticnoise.multiplatform-swiftpackage") version "2.0.3"
    }
    which gives me this error in AS:
    Error resolving plugin [id: 'org.jetbrains.kotlin.plugin.serialization', version: '1.4.30']
    > Plugin request for plugin already on the classpath must not include a version
    it works if I remove the version, but then fails when I do the iOS framework build. The serialzation github page shows to include the version. What is the issue here?
    t
    c
    v
    • 4
    • 26
  • w

    william

    02/27/2021, 4:41 PM
    is there a way to do something like this for all modules in a multiplatform project?
    // ignore these warnings
    kotlin.target.compilations.all {
        allKotlinSourceSets.forEach { sourceSet ->
            sourceSet.languageSettings.apply {
                useExperimentalAnnotation("kotlinx.coroutines.FlowPreview")
                useExperimentalAnnotation("kotlinx.coroutines.ExperimentalCoroutinesApi")
                useExperimentalAnnotation("io.ktor.util.KtorExperimentalAPI")
            }
        }
    }
    t
    m
    • 3
    • 7
  • a

    Aslam Hossin

    03/03/2021, 12:12 PM
    _What should_ we do _about the current android project?_
    UPDATE: To better support the community in this migration, JFrog has extended the JCenter new package versions submission deadline through March 31st 2021. To clarify, the JCenter repository will keep serving packages for 12 months until February 1st 2022. Only the JCenter REST API and UI will be sunsetted on May 1st 2021.
    v
    g
    • 3
    • 16
  • h

    HaiTrvn Lưu Trữ

    03/04/2021, 10:08 AM
    i created backend module in KMM project and to reuse model classes in commonMain source set (shared module), so i just add to ‘backend’ module :
    dependencies {
        implementation(project(":shared"))
        ...
    }
    and i got this error message:
    Failed to resolve: project::shared
    Affected Modules: KMMM.backend
    sorry my english is bad my Repository https://github.com/haitrvnvn/KMMM
    t
    • 2
    • 2
  • j

    Jeremy

    03/04/2021, 6:15 PM
    More than one file was found with OS independent path 'META-INF/AL2.0'.
    Added exclude to the packagingOptions in android{} but still getting err. This is occurring only for instrumented tests. Any ideas?
    g
    • 2
    • 3
  • l

    leandro

    03/05/2021, 3:33 PM
    How could I pass compiler args in a multiplatform repository? e.g. on my root `build.gradle`:
    allprojects {
      tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinCompile).configureEach { task ->
        task.kotlinOptions {
        }
      }
    }
    but this errors with
    Execution failed for task ':mymodule:runCommonizer'.
    > Could not create task ':mymodule:compileKotlinIosArm64'.
       > Cannot query the value of task ':mymodule:compileKotlinIosArm64' property 'compilation' because it has no value available.
    note
    mymodule
    has the
    multiplatform
    plugin applied
    b
    • 2
    • 17
  • m

    Marcello Galhardo

    03/07/2021, 12:34 AM
    Hey all, I have a multi-module Android project which contains multiple applications. Each one of those application modules includes a set of interfaces that an annotation processor will use to generate code based on the class-path of this module. Today, those interfaces are duplicated, and I can't move them to a shared module due to the code generation requirement (class-path). I tried to create a shared folder and include it as a source directory to all those application modules (I know this sounds ridiculous, but I did not find another way...) but, for some reason, only one of the application modules randomly recognized the folder as part of it (sourceroot) and the others fails (both at IDE and compilation level). Is there a way to include a piece of code in multiple modules to be compiled and processed inside the included module? I appreciate any help you can provide.
    v
    • 2
    • 5
  • d

    darkmoon_uk

    03/07/2021, 12:41 AM
    Is anyone using
    kotlinx.serialization
    as part of their Gradle build process? I'vde added the Kotlin Serialization plugin but still classes I've marked
    @Serializable
    in the script aren't being recognised as such; yielding
    kotlinx.serialization.SerializationException: Serializer for class 'MyClassName' is not found.
    at the point of use. Any tips?
    v
    • 2
    • 1
  • v

    Victor Cardona

    03/08/2021, 2:15 PM
    Hello! I am trying to create a demo project using Kotlin that must build and run in an environment without access to the internet. For the project dependencies I have downloaded all the jars and placed them in a lib directory. I tried doing something similar with the plugin and it’s dependencies, but have not found a way to successfully compile my code. During the build I get the following error:
    Could not determine the dependencies of task ':compileKotlin'.
    > Could not resolve all files for configuration ':kotlinCompilerClasspath'.
       > Cannot resolve external dependency org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.10 because no repositories are defined.
         Required by:
             project :
    Here is how I’m trying to load the plugin locally:
    buildscript {
        repositories {
            flatDir { dirs("plugins") }
        }
        dependencies {
            classpath(":kotlin-gradle-plugin:1.4.10")
            classpath(":kotlin-gradle-plugin-api:1.4.10")
            classpath(":kotlin-gradle-plugin-model:1.4.10")
            classpath(":kotlin-compiler-embeddable:1.4.10")
            classpath(":kotlin-compiler-runner:1.4.10")
            classpath(":kotlin-daemon-embeddable:1.4.10")
            classpath(":kotlin-daemon-client:1.4.10")
            ...
        }
    }
    
    apply(plugin = "org.jetbrains.kotlin.jvm")
    Can anyone suggest how I can do what I’m attempting? Thanks in advance.
    r
    t
    • 3
    • 2
  • f

    Fleshgrinder

    03/08/2021, 5:54 PM
    Not sure if this should go to the Gradle Slack, #intellij, or this is the right place but I'm trying it here first. I have a pretty standard Gradle setup with an
    includeBuild
    where I have
    kotlin { explicitApi() }
    in the
    build.gradle.kts
    file. The problem is that IntelliJ completely ignores this setting and every time I have
    public something
    IntelliJ complains that this is superfluous.
    ➕ 2
    e
    t
    p
    • 4
    • 5
  • c

    Christoph Hock

    03/08/2021, 7:46 PM
    Is there a way to run a Kotlin Fullstack(JVM+JS) with --continuous mode?
    b
    • 2
    • 2
  • l

    Lauren Yew

    03/09/2021, 10:24 PM
    Hi all, I had to update to android gradle plugin
    com.android.tools.build:gradle
    to
    7.0.0-alpha09
    to get Jetpack compose running. Now when I run
    publishToMavenLocal
    , I get the error
    * What went wrong:
    Execution failed for task ':<library>:generatePomFileForLibraryAarPublication'.
    > Could not apply withXml() to generated POM
       > Configuration with name 'compile' not found.
    Has anyone else run into this issue?
    g
    • 2
    • 3
  • l

    Lauren Yew

    03/09/2021, 10:26 PM
    Is there a gradle 7.0.0 migration guide somewhere?
    n
    • 2
    • 4
  • n

    no

    03/10/2021, 8:40 AM
    Hey fellow Kotliners. We (Gradle) are hosting a live 30 minute game show t*omorrow* entitled "_*Android Developer Productivity Engineering at Scale".*_ The panelists are @py, @Ty Smith, Emily and myself. We will be asked questions by our host Rooz and you (the audience_)_ will get to vote on the best answers. Register here to watch for free https://gradle.com/devprodeng-showdown-s1e2/ You can also retweet.
    a
    • 2
    • 2
  • h

    holgerbrandl

    03/10/2021, 5:22 PM
    Hi there, I've adopted some of my opensource kotlin projects to publish to maven-central using maven-publish and io.codearte.nexus-staging plugin. However, now I'm stuck migrating my newer bits and pieces that use a build.gradle.kts because I still can't wrap my head around how to translate gradle to gradle-kts. Is there a minimalistic example which I could use as template instead?
    g
    j
    • 3
    • 12
  • a

    andrewreitz

    03/13/2021, 6:58 PM
    Hi, I’m using kotlin-js w/ IR compiler and my kotlin gradle scripts in Intellij Community are all red and not supporting auto complete. The project builds just fine, does anyone have a solution to this? Seems to happen in any of my kotlin-js projects.
    v
    f
    +3
    • 6
    • 12
  • c

    Christoph Hock

    03/16/2021, 12:14 AM
    Hi everyone, not sure if this is the right channel for this but maybe someone can send me to the correct channel if I am wrong. I have created a Project with two modules server (ktor jvm) and client (js ir compiler browser target). The goal I am trying to achive is to get both modules to build when ever there is a change that requires that specific module to be rebuild and to load these changes into the runnning application if possible. I therefore activated devmode for ktor and enabled autoreload. I then start the ktor application from within intellij and also run
    gradle installDist -t
    for the server module in an extra task. Serverreloads work greate with this solution but I can't get the client js part to work propally. For the client part I added the following code to my build.gradle.kts inside my server module
    tasks.withType<Copy>().named("processResources") {
        dependsOn(":client:browserDistribution")
        from(project(":client").tasks.named("browserDistribution"))
    }
    The first time I make changes to the client module while
    gradle installDist -t
    is running the changes get compiled and copied over to the servermodule, but any changes after that don't get copied over, even thougth the build is reran. Am I doing something wrong? Any advice on how to fix this?
    v
    t
    • 3
    • 8
  • b

    bjonnh

    03/16/2021, 2:11 PM
    It seems that it is really related to the way the kotlin plugin compiles kotlin code and uses the module information.
    t
    j
    v
    • 4
    • 40
  • c

    Carter

    03/16/2021, 8:21 PM
    I’m having a bit of trouble with the gradle shadow plugin
    com.github.johnrengelman.shadow
    I’m trying to create a fat JAR from various kotlin modules and my attempts to exclude transitive dependencies don’t seem to be working. My output JAR is truly fat at 820mb. I’ve tried doing this, which is what I think I need:
    dependencies {
        implementation(project(":brainLib")) {
            transitive = false
        }
    }
    But I get the error:
    Could not determine the dependencies of task ':brainLib:compileKotlinJvm'.
    > Could not resolve all dependencies for configuration ':brainLib:jvmCompileClasspath'.
      > Cannot change dependencies of dependency configuration ':brainLib:commonMainApi' after it has been included in dependency resolution.
    I also tried this, which is supposed to be like a “keep” rule in proguard, but that didn’t work either. (I think because the huge dependencies are transitive under brainLib).
    shadowJar {
        minimize {
            exclude(project(":brainLib"))
        }
    }
    Are there other suggestions as to what I could try?
    t
    • 2
    • 21
  • e

    eygraber

    03/17/2021, 4:38 AM
    My gradle syncs in Android Studio (4.1.2) used to take a few seconds, rarely tens of seconds. The past few days they started taking 2+ minutes. The only thing I changed was that I moved
    jCenter
    below all of my other repositories. The only thing that gets logged is:
    > Task :prepareKotlinBuildScriptModel UP-TO-DATE
    
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See <https://docs.gradle.org/6.8.3/userguide/command_line_interface.html#sec:command_line_warnings>
    
    BUILD SUCCESSFUL in 2m 33s
    I'm using Groovy gradle, and don't have a buildSrc directory. My project uses Kotlin 1.4.31. Anyone know what's up with that?
    n
    v
    j
    • 4
    • 11
  • p

    PHondogo

    03/17/2021, 11:13 PM
    Hello! I have multi module gradle project with kotlin multiplatform as a module. In one gradle module i created custom common sourceset and in other module i want to depend on them in common code. How can I do this?
    j
    • 2
    • 3
  • p

    Paul Woitaschek

    03/18/2021, 6:01 AM
    Is it possible to limit the amount of kotlin and gradle daemons? I'm working on a mpp library and an android application simulatenously and now I have the double amount of ram consumption. I'm on 32gig ram but that still pushes my system to the limit
    v
    t
    k
    • 4
    • 8
  • b

    bitkid

    03/18/2021, 10:20 AM
    hey! does anyone else have the problem that IDEA depends on the gradle-api jar and that dependencies in the that jar conflict with your local classes (in my case f.ex. slf4j which is also packages in the gradle jar)
    r
    c
    r
    • 4
    • 20
  • r

    robfletcher

    03/18/2021, 2:49 PM
    Anyone else see
    java.lang.NoClassDefFoundError: Could not initialize class org.jetbrains.kotlin.com.intellij.pom.java.LanguageLevel
    trying to run a Gradle build with Kotlin scripts under
    buildSrc
    using the new Zulu JDK 16?
    c
    t
    • 3
    • 23
  • s

    scirner

    03/18/2021, 10:26 PM
    Question on compile vs runtime versions. I have an app that has a transitive dependency that shows up on the compile classpath
    grpc 1.17
    . I depend on another library that uses
    implementation grpc 1.32
    . So on the runtime classpath it correctly resolves to
    |    |         +--- io.grpc:grpc-netty:1.17.1 -> 1.32.2 (*)
    . The problem is when you actually run the application you get a noclassdef found error for something that exists in
    1.32
    . A hack to fix this is for the app to depend on
    1.32
    itself but I'm trying to understand why this is a problem. The runtime classpath is resolving how I expect it to. Are the compile classpath versions strictly preferred or something?
    v
    • 2
    • 2
  • j

    Jonathan Olsson

    03/19/2021, 11:15 AM
    Hi! Using gradle 6.8.3 in a multi project build, I am trying to resolve a plugin using the plugins closure rather than the buildscript closure but cannot get it to resolve to the correct artifact. Previously this worked:
    # root/build.gradle:
    buildscript { 
      repositories {
        maven {
          url "$url"
          credentials { ... }
        }
      }
      dependencies {
        classpath "my.org.foo:my-plugin:$version"
      }
    }
    And then I could simply:
    apply plugin: 'my.org.foo'
    Now I try to replace this by what appears to be the "modern" approach:
    # root/settings.gradle
    pluginManagement {
        repositories {
            maven {
                url "$url"
                credentials { ... }
            }
        }
    }
    
    # root/subModule/build.gradle
    plugins {
      id 'my.org.foo' version '...'
    }
    Now, when doing this gradle tries to resolve this to
    'my.org.foo:my.org.foo.gradle.plugin:$version'
    . How do I make gradle understand how to locate the proper artifact? Thanks!
    t
    v
    • 3
    • 6
Powered by Linen
Title
j

Jonathan Olsson

03/19/2021, 11:15 AM
Hi! Using gradle 6.8.3 in a multi project build, I am trying to resolve a plugin using the plugins closure rather than the buildscript closure but cannot get it to resolve to the correct artifact. Previously this worked:
# root/build.gradle:
buildscript { 
  repositories {
    maven {
      url "$url"
      credentials { ... }
    }
  }
  dependencies {
    classpath "my.org.foo:my-plugin:$version"
  }
}
And then I could simply:
apply plugin: 'my.org.foo'
Now I try to replace this by what appears to be the "modern" approach:
# root/settings.gradle
pluginManagement {
    repositories {
        maven {
            url "$url"
            credentials { ... }
        }
    }
}

# root/subModule/build.gradle
plugins {
  id 'my.org.foo' version '...'
}
Now, when doing this gradle tries to resolve this to
'my.org.foo:my.org.foo.gradle.plugin:$version'
. How do I make gradle understand how to locate the proper artifact? Thanks!
t

tapchicoma

03/19/2021, 11:29 AM
you could use
pluginManagment
in
settings.gradle.kts
, for example for android plugin:
pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
    }
    resolutionStrategy {
        eachPlugin {
            when (requested.id.id) {
                "com.android.application" ->
                    useModule("com.android.tools.build:gradle:${requested.version}")
            }
        }
    }
}
j

Jonathan Olsson

03/19/2021, 11:39 AM
Thanks. That actually worked! 🙏 It would be fancier if the plugins closure itself allowed you to specify the artifact and not just id. But I'm sure there are good reasons for this. 🙂
t

tapchicoma

03/19/2021, 11:45 AM
you could also add all deps in
buildSrc/build.gradle.kts
old way 🤷‍♂️
v

Vampire

03/19/2021, 3:03 PM
For the ID to magically work you need to have the marker artifact in your repository. If you use the Gradle Plugin Development Plugin when publishing your plugin it will automatically also publish this marker artifact. If the marker artifact is missing, then you need to compensate that in the settings script. Specifying the mapping in the
plugins
block would be unnecessary clutter as you then need to specify it on every usage instead of one time centrally. The marker artifacts are the default way how a plugin id is translated to the actual dependency. Imagine you have an artifact
my-plugins.jar
that contains the plugins
my-a
,
my-b
and
my-c
. Then you will have three "marker artifacts" that follow the naming convention you have seen and then depend on the
my-plugins.jar
.
j

Jonathan Olsson

03/19/2021, 9:04 PM
Thanks a lot! Works like a charm. Next step: figure out how to make com.jfrog.artifactory play nice with java-gradle-plugin. 🙂
Ahh. But of course. We want to publish xPluginMarkerMaven. The plugin artifact itself was named something like xPlugin so the artifact was actually name xPluginPluginMarkerMaven. 🍻 Thanks again for your help! Much appreciated.
View count: 24