Plugin drags along a lot of dependencies with it
See original GitHub issueLibrary 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:
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:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top GitHub Comments
@dariuszkuc On a somewhat related note, maybe we want to rebrand
graphql-kotlin-plugin-core
as a separate modulegraphql-kotlin-code-generator
orgraphql-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 executableWe 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.