{"id":15530682,"url":"https://github.com/jpenilla/gremlin","last_synced_at":"2026-01-04T08:33:50.029Z","repository":{"id":204170203,"uuid":"711240732","full_name":"jpenilla/gremlin","owner":"jpenilla","description":"Gradle plugin and Java library for resolving Gradle Configurations at runtime","archived":false,"fork":false,"pushed_at":"2024-05-22T23:04:18.000Z","size":286,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-22T23:46:47.194Z","etag":null,"topics":["gradle-plugin","java-library","runtime-dependencies"],"latest_commit_sha":null,"homepage":"https://plugins.gradle.org/plugin/xyz.jpenilla.gremlin-gradle","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpenilla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-28T16:26:20.000Z","updated_at":"2024-06-02T05:21:13.528Z","dependencies_parsed_at":null,"dependency_job_id":"22a1a7f8-049b-472e-9bef-790b4c43d4ec","html_url":"https://github.com/jpenilla/gremlin","commit_stats":null,"previous_names":["jpenilla/gremlin"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpenilla%2Fgremlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpenilla%2Fgremlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpenilla%2Fgremlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpenilla%2Fgremlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpenilla","download_url":"https://codeload.github.com/jpenilla/gremlin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245007238,"owners_count":20546142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle-plugin","java-library","runtime-dependencies"],"created_at":"2024-10-02T11:23:34.785Z","updated_at":"2026-01-04T08:33:50.017Z","avatar_url":"https://github.com/jpenilla.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gremlin\n[![latest release](https://img.shields.io/gradle-plugin-portal/v/xyz.jpenilla.gremlin-gradle?label=latest%20version)](https://plugins.gradle.org/plugin/xyz.jpenilla.gremlin-gradle)\n\nAlthough runtime dependency resolution is generally looked at as an anti-pattern, there are cases where it can be a necessary evil.\ngremlin is a Gradle plugin and Java library for resolving Gradle `Configuration`s at runtime.\n\n## Usage\n\n### Gradle configuration\nFirst, apply the `gremlin-gradle` plugin to your project.\n```kotlin\nplugins {\n  id(\"xyz.jpenilla.gremlin-gradle\") version \"VERSION\"\n}\n```\n\nApplying the plugin will set up the following:\n##### Extensions\n- `gremlin`: The gremlin extension allows configuring plugin-wide options\n  - `defaultGremlinRuntimeDependency`: Whether `gremlin-runtime` (with the same version as the Gradle plugin) should be added to the `implementation` `Configuration`\n  - `defaultJarRelocatorDependencies`: Whether the default jar relocator dependencies should be added to the `jarRelocatorRuntime` `Configuration`\n##### Configurations\n- `runtimeDownload`: The `Configuration` that is exported by the default `writeDependencies` task\n- `jarRelocatorRuntime`: The `Configuration` containing the `jar-relocator` runtime, used when there are relocations\n##### Tasks\n- `writeDependencies`: The default `WriteDependencyTask` registered to export the `runtimeDownload` configuration. The output (`dependencies.txt`) is added as a resource to the main source set.\n\n#### Relocation and extensions\ngremlin supports extending the runtime and Gradle plugin with custom `JarProcessor`s, and includes the `RelocationProcessor`.\nRelocations set using gremlin will also need to be applied to the project output. The `ShadowGremlin` utility is provided to simplify\nadding the same relocations to gremlin and `shadowJar`.\n```kotlin\nfun reloc(fromPkg: String, toPkg: String) {\n    listOf(tasks.shadowJar, tasks.writeDependencies).forEach { task -\u003e\n        task.configure {\n            ShadowGremlin.relocate(this, fromPkg, toPkg)\n        }\n    }\n}\n\nreloc(\"some.package\", \"relocated.some.package\")\n```\n\n#### Adding runtime-downloaded dependencies\nTo add a runtime-downloaded dependency, simply add it to the `runtimeDownload` configuration in the same way you would for `implementation` or `compileOnly`.\nSnapshot dependencies will be pinned to the currently resolved version in the output, and exclusions or other resolution rules will also apply. This is because\n`gremlin-gradle` stores a flattened and resolved view of the dependencies, rather than forcing the runtime to deal with transitive dependencies and other complicated logic.\n\nA common configuration is to also add `runtimeDownload` dependencies to `compileOnly` and `testImplementation`:\n```kotlin\nconfigurations.compileOnly {\n    extendsFrom(configurations.runtimeDownload.get())\n}\nconfigurations.testImplementation {\n    extendsFrom(configurations.runtimeDownload.get())\n}\n```\n\n#### Advanced configurations\nIt is possible to register more dependency sets than the default one by manually configuring new `WriteDependencySet` tasks.\n\n### Runtime setup\n\nThe runtime is available at `xyz.jpenilla:gremlin-runtime` on Maven Central.\nYou only need to manually add a dependency on it when you have disabled the automatic runtime dependency mentioned above.\n\nThe entrypoint to the runtime component is the `DependencyResolver`. The following is an example that resolves the default `dependencies.txt` set:\n```java\nfinal DependencySet deps = DependencySet.readDefault(this.getClass().getClassLoader());\nfinal DependencyCache cache = new DependencyCache(/* cache directory */);\ntry (final DependencyResolver downloader = new DependencyResolver(/* logger */)) {\n    final Set\u003cPath\u003e jars = downloader.resolve(deps, cache).jarFiles();\n    // ...\n}\ncache.cleanup();\n```\n\n`gremlin-runtime` also provides utilities for appending to the classpath in common environments:\n- `PaperClasspathAppender`: utility to append jars to a Paper plugin's classpath using the Paper `PluginLoader` API\n- `DefaultsPaperPluginLoader`: prebuilt Paper `PluginLoader` that resolves the default `dependencies.txt` set and appends it to the plugin classpath using `PaperClasspathAppender`.\n- `FabricClasspathAppender`: utility to append jars to the Fabric classpath\n- `VelocityClasspathAppender`: utility to append jars to a Velocity plugin's classpath\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpenilla%2Fgremlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpenilla%2Fgremlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpenilla%2Fgremlin/lists"}