{"id":20230989,"url":"https://github.com/bewaremypower/shadeplugindemo","last_synced_at":"2026-05-10T18:14:43.264Z","repository":{"id":109020675,"uuid":"381781097","full_name":"BewareMyPower/ShadePluginDemo","owner":"BewareMyPower","description":"An example to use maven-shade-plugin.","archived":false,"fork":false,"pushed_at":"2021-07-05T09:36:26.000Z","size":33,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-14T00:22:16.259Z","etag":null,"topics":["kafka","maven","shaded"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BewareMyPower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-06-30T17:21:34.000Z","updated_at":"2024-07-16T13:02:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b5c17ad-194d-451a-b9a5-e706d9250161","html_url":"https://github.com/BewareMyPower/ShadePluginDemo","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/BewareMyPower%2FShadePluginDemo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2FShadePluginDemo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2FShadePluginDemo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BewareMyPower%2FShadePluginDemo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BewareMyPower","download_url":"https://codeload.github.com/BewareMyPower/ShadePluginDemo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241677352,"owners_count":20001672,"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":["kafka","maven","shaded"],"created_at":"2024-11-14T07:44:45.068Z","updated_at":"2026-05-10T18:14:43.220Z","avatar_url":"https://github.com/BewareMyPower.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ShadePluginDemo\n\nAn example to use [maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-plugin/).\n\n## Get started\n\nMake sure you have already run a local [Kafka]() broker that listens at localhost:9092.\n\nFirst build the project:\n\n```bash\nmvn clean install\n```\n\nThen run the demo:\n\n```bash\nmvn exec:java -Dexec.mainClass=Demo -pl demo\n```\n\n## What's this?\n\nIt's an example that makes a class use variant versions of Kafka client. Usually we can't import the same dependency with multiple versions. However, with the help of maven-shade-plugin, we can archive the similar result.\n\nFor example, this project has multiple modules:\n- kafka-1-0-0\n- kafka-2-0-0\n\nEach module wraps a different version of Kafka client. Without the maven-shade-plugin, the `demo` module, which imports these modules as the dependencies, will only choose **one** version of `org.apache.kafka:kafka-clients`.\n\n## Wrong version and commit id\n\nYou may see followed logs.\n\n```\n2021-07-01 00:51:37:581 [Demo.main()] INFO org.apache.kafka-1-0-0.common.utils.AppInfoParser - Kafka version : 1.0.0\n2021-07-01 00:51:37:581 [Demo.main()] INFO org.apache.kafka-1-0-0.common.utils.AppInfoParser - Kafka commitId : aaa7af6d4a11b29d\n```\n\nIt's okay because `AppInfoParser` reads the version and commit id from the same `/kafka/kafka-version.properties`.\n\n## Intellj Idea\n\nIntellij Idea doesn't support maven-shade-plugin well, if you just click the button to run `Demo.main`, the classes may still be loaded from `org.apache.kafka` package but not `org.apache.kafka-x-y-z` package.\n\nTo solve this issue, you need to:\n1. Right click on `pom.xml` of shaded modules like `kafka_1_0`.\n2. Choose \"Maven\" - \"Ignore Projects\".\n3. Right click on the `pom.xml` of the project.\n4. Choose \"Maven\" - \"Reload project\".\n\nThen Idea will load classes from shaded JARs. However, since shaded modules are ignored by Idea, the code completion is disabled for these modules. So we need to reimport the shaded modules.\n1. Right click on `pom.xml` of shaded modules like `kafka_1_0`.\n2. Choose \"Maven\" - \"Unignore Projects\".\n\nSee [here](https://stackoverflow.com/questions/30407065/getting-intellij-to-import-shaded-dependencies-in-a-multi-module-maven-project/30898810) for reference.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbewaremypower%2Fshadeplugindemo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbewaremypower%2Fshadeplugindemo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbewaremypower%2Fshadeplugindemo/lists"}