Skip to content

Gradle plugin. Don't add objectbox-kotlin dependency if it's already added #693

@Zellius

Description

@Zellius

Issue Basics

  • ObjectBox version: 2.3.4
  • Reproducibility: always

Reproducing the bug

Description

ObjectBox Gradle plugin keeps adding the api "io.objectbox:objectbox-kotlin" dependency even if I already added it as implementation dependency. The plugin should ignore it at this case like it does with other ObjecBox dependencies.

api - API dependencies for 'main' sources. (n)
+--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.21 (n)
+--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.0 (n)
+--- androidx.core:core-ktx:1.0.1 (n)
--- io.objectbox:objectbox-kotlin:2.3.4 (n)

Code

plugins {
    id("com.android.library")
    kotlin("android")
    kotlin("kapt")
}

dependencies {
    api(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
    api(kotlin("stdlib-jdk8", KotlinCompilerVersion.VERSION))

    implementation("io.objectbox:objectbox-android:2.3.4")
    implementation("io.objectbox:objectbox-kotlin:2.3.4")
    kapt("io.objectbox:objectbox-processor:2.3.4")
}

apply {
    plugin("io.objectbox")
}

I use kotlin-dsl. But I don't think that it's related to the issue.

I manually remove all ObjectBox' api dependencies by placing this code above the plugin.

configurations.getByName("api").dependencies.also { deps ->
    deps.matching {
        it.group == "io.objectbox"
    }.whenObjectAdded {
        deps.remove(this)
    }
}

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions