{"id":17329628,"url":"https://github.com/haines/shade","last_synced_at":"2025-04-14T17:40:05.389Z","repository":{"id":62433367,"uuid":"81956675","full_name":"haines/shade","owner":"haines","description":"Relocate namespaces in Clojure uberjars","archived":false,"fork":false,"pushed_at":"2020-10-01T18:08:53.000Z","size":19,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-02-16T04:06:38.801Z","etag":null,"topics":["clojure","leiningen"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"epl-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haines.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-14T15:00:46.000Z","updated_at":"2021-11-29T22:31:10.000Z","dependencies_parsed_at":"2022-11-01T21:01:36.045Z","dependency_job_id":null,"html_url":"https://github.com/haines/shade","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haines%2Fshade","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haines%2Fshade/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haines%2Fshade/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haines%2Fshade/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haines","download_url":"https://codeload.github.com/haines/shade/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240236235,"owners_count":19769573,"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":["clojure","leiningen"],"created_at":"2024-10-15T14:49:00.046Z","updated_at":"2025-02-25T19:31:10.736Z","avatar_url":"https://github.com/haines.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shade\n\nshade is a tool for relocating namespaces within uberjars to avoid dependency clashes.\n\n## Motivation\n\nTest helper libraries' dependencies are liable to clash with those of the code under test.\nTo avoid this, the helper library can be distributed as an uberjar with its dependencies \"shaded\" under a different namespace.\n\n## Installation\n\nThe easiest way to get started is to add the lein-shade plugin to your Leiningen project map:\n\n```clojure\n:plugins [[lein-shade \"0.4.0\"]]\n```\n\n## Usage\n\nAs is typical when building an uberjar, you'll need to use AOT compilation:\n\n```clojure\n:profiles {...\n           :uberjar {:aot :all}\n           ...}\n```\n\nUnlike when building an application uberjar, you probably don't want to bundle Clojure itself.\nYou can omit it by moving the dependency to the `:provided` profile:\n\n```clojure\n:profiles {...\n           :provided {:dependencies [[org.clojure/clojure \"1.8.0\"]\n                                     ...]}\n           ...}\n```\n\nYou'll want to omit dependencies that are bundled in the uberjar from the POM, otherwise consumers of your library will download them as transitive dependencies.\nTo do so, move your dependencies to the `:shaded` profile, and add `:shaded` to your `:default` profile:\n\n```clojure\n:profiles {...\n           :shaded {:dependencies [...]}\n           :default [:leiningen/default :shaded]\n           ...}\n```\n\nIf you run `lein shade-jar` now, you'll get an uberjar under `target/shaded`.\nHowever, the namespaces within your dependencies won't have been relocated, so version clashes will still be problematic.\nTo relocate those namespaces, you need to specify them in your project map:\n\n```clojure\n:shade {:namespaces [foo.bar\n                     ...]}\n```\n\nNow when you run `lein shade-jar`, those namespaces will have been hidden under the `your-project.shaded` namespace in the uberjar (so `foo.bar` is now `your-project.shaded.foo.bar`).\n\nYou can customize where shaded dependencies are hidden if you want:\n\n```clojure\n:shade {:namespaces [...]\n        :under my-project.hidden}\n```\n\n### Deploying shaded uberjars\n\nYou can deploy your shaded uberjar using `lein deploy-shaded-jar [repository]`.\nYou might want to alias the `deploy` task:\n\n```clojure\n:aliases {...\n          \"deploy\" [\"deploy-shaded-jar\" \"clojars\"]\n          ...}\n```\n\nYou can also install your shaded uberjar to your local repository using `lein install-shaded-jar`.\nSimilarly, you might want to alias the `install` task:\n\n```clojure\n:aliases {...\n          \"install\" [\"install-shaded-jar\"]\n          ...}\n```\n\n## License\n\nCopyright © 2017 Red Badger\n\nDistributed under the Eclipse Public License either version 1.0 or (at your option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaines%2Fshade","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaines%2Fshade","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaines%2Fshade/lists"}