question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin drags along a lot of dependencies with it

See original GitHub issue

Library Version 4.0.0-alpha.7

Describe the bug

From what it looks like, applying the com.expediagroup.graphql plugin to your Gradle build will add the following dependencies to the Gradle plugin classpath:

  - graphql-java-15.0.jar (com.graphql-java:graphql-java:15.0) from repository Gradle Central Plugin Repository
  - graphql-kotlin-client-4.0.0-alpha.7.jar (com.expediagroup:graphql-kotlin-client:4.0.0-alpha.7) from repository Gradle Central Plugin Repository
  - graphql-kotlin-gradle-plugin-4.0.0-alpha.7.jar (com.expediagroup:graphql-kotlin-gradle-plugin:4.0.0-alpha.7) from repository Gradle Central Plugin Repository
  - graphql-kotlin-ktor-client-4.0.0-alpha.7.jar (com.expediagroup:graphql-kotlin-ktor-client:4.0.0-alpha.7) from repository Gradle Central Plugin Repository
  - graphql-kotlin-plugin-core-4.0.0-alpha.7.jar (com.expediagroup:graphql-kotlin-plugin-core:4.0.0-alpha.7) from repository Gradle Central Plugin Repository
  - graphql-kotlin-spring-client-4.0.0-alpha.7.jar (com.expediagroup:graphql-kotlin-spring-client:4.0.0-alpha.7) from repository Gradle Central Plugin Repository
  - graphql-kotlin-types-4.0.0-alpha.7.jar (com.expediagroup:graphql-kotlin-types:4.0.0-alpha.7) from repository Gradle Central Plugin Repository
  - jackson-annotations-2.11.3.jar (com.fasterxml.jackson.core:jackson-annotations:2.11.3) from repository Gradle Central Plugin Repository
  - jackson-core-2.11.3.jar (com.fasterxml.jackson.core:jackson-core:2.11.3) from repository Gradle Central Plugin Repository
  - jackson-databind-2.11.3.jar (com.fasterxml.jackson.core:jackson-databind:2.11.3) from repository Gradle Central Plugin Repository
  - jackson-module-kotlin-2.11.3.jar (com.fasterxml.jackson.module:jackson-module-kotlin:2.11.3) from repository Gradle Central Plugin Repository
  - java-dataloader-2.2.3.jar (com.graphql-java:java-dataloader:2.2.3) from repository Gradle Central Plugin Repository
  - kotlinpoet-1.6.0.jar (com.squareup:kotlinpoet:1.6.0) from repository Gradle Central Plugin Repository
  - ktor-client-cio-1.3.1.jar (io.ktor:ktor-client-cio:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-client-core-1.3.1.jar (io.ktor:ktor-client-core:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-client-core-jvm-1.3.1.jar (io.ktor:ktor-client-core-jvm:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-client-jackson-1.3.1.jar (io.ktor:ktor-client-jackson:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-client-json-1.3.1.jar (io.ktor:ktor-client-json:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-client-json-jvm-1.3.1.jar (io.ktor:ktor-client-json-jvm:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-http-1.3.1.jar (io.ktor:ktor-http:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-http-cio-1.3.1.jar (io.ktor:ktor-http-cio:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-http-cio-jvm-1.3.1.jar (io.ktor:ktor-http-cio-jvm:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-http-jvm-1.3.1.jar (io.ktor:ktor-http-jvm:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-io-1.3.1.jar (io.ktor:ktor-io:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-io-jvm-1.3.1.jar (io.ktor:ktor-io-jvm:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-network-1.3.1.jar (io.ktor:ktor-network:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-network-tls-1.3.1.jar (io.ktor:ktor-network-tls:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-utils-1.3.1.jar (io.ktor:ktor-utils:1.3.1) from repository Gradle Central Plugin Repository
  - ktor-utils-jvm-1.3.1.jar (io.ktor:ktor-utils-jvm:1.3.1) from repository Gradle Central Plugin Repository
  - netty-buffer-4.1.52.Final.jar (io.netty:netty-buffer:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-codec-4.1.52.Final.jar (io.netty:netty-codec:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-codec-http-4.1.52.Final.jar (io.netty:netty-codec-http:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-codec-http2-4.1.52.Final.jar (io.netty:netty-codec-http2:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-codec-socks-4.1.52.Final.jar (io.netty:netty-codec-socks:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-common-4.1.52.Final.jar (io.netty:netty-common:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-handler-4.1.52.Final.jar (io.netty:netty-handler:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-handler-proxy-4.1.52.Final.jar (io.netty:netty-handler-proxy:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-resolver-4.1.52.Final.jar (io.netty:netty-resolver:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-transport-4.1.52.Final.jar (io.netty:netty-transport:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-transport-native-epoll-4.1.52.Final-linux-x86_64.jar (io.netty:netty-transport-native-epoll:4.1.52.Final) from repository Gradle Central Plugin Repository
  - netty-transport-native-unix-common-4.1.52.Final.jar (io.netty:netty-transport-native-unix-common:4.1.52.Final) from repository Gradle Central Plugin Repository
  - reactive-streams-1.0.3.jar (org.reactivestreams:reactive-streams:1.0.3) from repository Gradle Central Plugin Repository
  - reactor-core-3.3.10.RELEASE.jar (io.projectreactor:reactor-core:3.3.10.RELEASE) from repository Gradle Central Plugin Repository
  - reactor-netty-0.9.12.RELEASE.jar (io.projectreactor.netty:reactor-netty:0.9.12.RELEASE) from repository Gradle Central Plugin Repository
  - spring-beans-5.2.9.RELEASE.jar (org.springframework:spring-beans:5.2.9.RELEASE) from repository Gradle Central Plugin Repository
  - spring-boot-starter-reactor-netty-2.3.4.RELEASE.jar (org.springframework.boot:spring-boot-starter-reactor-netty:2.3.4.RELEASE) from repository Gradle Central Plugin Repository
  - spring-core-5.2.9.RELEASE.jar (org.springframework:spring-core:5.2.9.RELEASE) from repository Gradle Central Plugin Repository
  - spring-jcl-5.2.9.RELEASE.jar (org.springframework:spring-jcl:5.2.9.RELEASE) from repository Gradle Central Plugin Repository
  - spring-web-5.2.9.RELEASE.jar (org.springframework:spring-web:5.2.9.RELEASE) from repository Gradle Central Plugin Repository
  - spring-webflux-5.2.9.RELEASE.jar (org.springframework:spring-webflux:5.2.9.RELEASE) from repository Gradle Central Plugin Repository

One of the core tenants of plugin development is that plugins should be lightweight and not require many third party dependencies. If you truly do need these dependencies inside of the plugin, you should consider shadowing them so that they appear only in your own custom namespace so they don’t pollute the global Gradle plugin classpath.

You can see a build scan displaying all of the dependencies brought along by your plugin here in this Gradle build scan: https://ge.gradle.org/s/c2h4xikwl3ddw/build-dependencies?toggled=W1syMV0sWzIxLDBdLFsyMSwwLFsxMTE5XV0sWzIxLDAsWzExMTksMTEyMF1dLFsyMSwwLFsxMTE5LDExMjAsMTEyMV1dLFsyMSwwLFsxMTE5LDExMjAsMTEyMSwxMzE3XV0sWzIxLDAsWzExMTksMTEyMCwxMTIxLDEzMjFdXSxbMjEsMCxbMTExOSwxMTIwLDExMjEsMTMxNl1dLFsyMSwwLFsxMTE5LDExMjAsMTEyMSwxMzI2XV0sWzIxLDAsWzExMTksMTEyMCwxMTIxLDEzMjBdXSxbMjEsMCxbMTExOSwxMTIwLDExMjEsMTMyMCwxMjk4XV0sWzIxLDAsWzExMTksMTEyMCwxMTIxLDEyMTNdXV0

You can find an example of how to do this shadowing here:

https://github.com/JLLeitschuh/ktlint-gradle/blob/2cc8184622039fb2d94d1a413f9ebfe2fd6a3113/plugin/build.gradle.kts#L66-L125

To Reproduce

Add the com.expediagroup.graphql to any gradle build and generate a Gradle Build Scan. From there, explore the dependencies.

Expected behavior

The Gradle plugin should either have light or no explicit dependencies.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
smyrickcommented, Nov 25, 2020

@dariuszkuc On a somewhat related note, maybe we want to rebrand graphql-kotlin-plugin-core as a separate module graphql-kotlin-code-generator or graphql-kotlin-client-generator.

Specifically we could extract everything in plugin-core today under com.expediagroup.graphql.plugin.generator into this new library that we could look into making as an executable

0reactions
dariuszkuccommented, Dec 17, 2020

@dariuszkuc On a somewhat related note, maybe we want to rebrand graphql-kotlin-plugin-core as a separate module graphql-kotlin-code-generator or graphql-kotlin-client-generator.

Specifically we could extract everything in plugin-core today under com.expediagroup.graphql.plugin.generator into this new library that we could look into making as an executable

We could but unsure if there is any benefit of making that JAR executable, i.e. since we provide both Gradle and Maven plugins I don’t know of many other use cases where people would want to execute that JAR directly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

maven assembly pulls wrong dependency
When I explicitly marked it as 2.4 (or the latest version when you read this!), the plugin pulled the correct dependency.
Read more >
Plugin Dependencies (Yet Another Plugin Dependencies Ticket)
When you go to install a plugin via the plugin directory UI in the admin area, the WP.org API returns a list of...
Read more >
Dependency Management in Gradle
The Gradle build pulls all dependencies down from the Maven Central repository, as defined by the repositories block. Let's focus on how we ......
Read more >
VORTEX - Beginner's Guide #5 : Dependencies and Conflicts
http://www.GophersVids.comContents:0:00 - Intro1:30 - Resolving A Conflict5:39 - Resolving Multiple Conflicts10:29 - Rules Work Both ...
Read more >
Learning the Basics
Gradle can resolve dependencies from one or many repositories based on Maven ... In dependency management, a lot of the decisions we make...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found