Skip to content

Kotlin stdlib shouldn't be a transitive dependency #227

Closed

Description

@tsegismont

Describe the bug

The POM file that is published to Maven Central declares the Kotlin stdlib as a transitive dependency.

But Kotlin is not used in production code

This dependency shouldn't be declared. It forces plain Java users to declare exclusions to avoid having a redundant JAR in their project distributions.

To Reproduce

See https://central.sonatype.com/artifact/com.graphql-java/java-dataloader/5.0.2

Activity

  1. bbakerman commented on Sep 3, 2025

    @bbakerman
    Member

    Yeah the dependency did indeed get added recently but only as a test dependency. We use Kotlin in tests to ensure things like @NullMarked work in Kotlin land as expected

    The dep is declared in Gradle as

        // just tests
        testCompileOnly 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
    

    So now it appears some how to be some sort of discrepancy between how gradle declares things and how the generated pom is being created on release.

    I can see that the generated pom.xml has

    <dependency>
          <groupId>org.jetbrains.kotlin</groupId>
          <artifactId>kotlin-stdlib</artifactId>
          <version>2.2.0</version>
          <scope>compile</scope>
        </dependency>
    

    and that is indeed wrong. Thanks for reporting.

  2. bbakerman commented on Sep 3, 2025

    @bbakerman
    Member

    ps. the same might be true of graphql-java which recently added Kotlin as a test compile only dep.

  3. bclozel commented on Sep 3, 2025

    @bclozel

    @bbakerman Applying the Kotlin Gradle plugin adds the stdlib dependency automatically. You can add a one-liner in your gradle.properties file to disable this behavior.

  4. bbakerman commented on Sep 3, 2025

    @bbakerman
    Member

    Thanks for that @bclozel - we will fix this up

  5. tsegismont commented on Sep 30, 2025

    @tsegismont
    Author

    Thank you @bbakerman!

  6. added a commit that references this issue on Oct 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions