{"id":20032693,"url":"https://github.com/lucko/jar-relocator","last_synced_at":"2026-03-08T11:32:55.384Z","repository":{"id":40432017,"uuid":"117369360","full_name":"lucko/jar-relocator","owner":"lucko","description":"A Java program to relocate classes within a jar archive using ASM.","archived":false,"fork":false,"pushed_at":"2023-06-08T20:27:11.000Z","size":50,"stargazers_count":98,"open_issues_count":2,"forks_count":19,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T17:09:45.691Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/lucko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2018-01-13T18:50:18.000Z","updated_at":"2025-03-02T17:28:51.000Z","dependencies_parsed_at":"2024-11-13T09:49:42.111Z","dependency_job_id":null,"html_url":"https://github.com/lucko/jar-relocator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucko%2Fjar-relocator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucko%2Fjar-relocator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucko%2Fjar-relocator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucko%2Fjar-relocator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucko","download_url":"https://codeload.github.com/lucko/jar-relocator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252445633,"owners_count":21749091,"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":[],"created_at":"2024-11-13T09:38:47.013Z","updated_at":"2026-03-08T11:32:55.377Z","avatar_url":"https://github.com/lucko.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jar-relocator\n[![Javadocs](https://javadoc.io/badge/me.lucko/jar-relocator.svg)](https://javadoc.io/doc/me.lucko/jar-relocator)\n[![Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/me/lucko/jar-relocator/maven-metadata.xml.svg?label=maven%20central\u0026colorB=brightgreen)](https://search.maven.org/artifact/me.lucko/jar-relocator)\n\nA Java program to relocate classes within a jar archive using ASM. (effectively a standalone implementation of the relocation functionality provided by the [maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-plugin/).)\n\nShading allows Java developers to include both their app *and* library dependencies in one \"uber\" jar archive. This means dependencies are always available without needing to append them onto the classpath manually. However, this can cause problems if duplicate copies of the same class are on the classpath at the same time.\n\nTo address this issue, you can relocate the \"shaded\" classes to your own package/namespace in order to prevent conflicts.\n\n### Why not just use the maven-shade-plugin?\n\nIf you can relocate at build time - you should.\n\nHowever, there are times where you might want to relocate at runtime, or at some other stage. My usecase is the app downloading dependencies dynamically from a repository on first startup, and needing to relocate then.\n\n### Usage\n\njar-relocator is [available from Maven Central, group id: `me.lucko`, artifact id: `jar-relocator`](https://search.maven.org/artifact/me.lucko/jar-relocator).\n\njar relocator has two dependencies: ASM and ASM Commons.\n\n\n```java\nimport me.lucko.jarrelocator.JarRelocator;\nimport me.lucko.jarrelocator.Relocation;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class Bootstrap {\n\n    public static void main(String[] args) {\n        File input = new File(\"input.jar\");\n        File output = new File(\"output.jar\");\n\n        List\u003cRelocation\u003e rules = new ArrayList\u003c\u003e();\n        rules.add(new Relocation(\"com.google.common\", \"me.lucko.test.lib.guava\"));\n        rules.add(new Relocation(\"com.google.gson\", \"me.lucko.test.lib.gson\"));\n\n        JarRelocator relocator = new JarRelocator(input, output, rules);\n\n        try {\n            relocator.run();\n        } catch (IOException e) {\n            throw new RuntimeException(\"Unable to relocate\", e);\n        }\n    }\n\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucko%2Fjar-relocator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucko%2Fjar-relocator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucko%2Fjar-relocator/lists"}