Skip to content

[Do not Merge] feat: add java-sdk-shaded artifact with org.json shading#114

Open
ppatibandla wants to merge 1 commit intomainfrom
feat/shade-org-json
Open

[Do not Merge] feat: add java-sdk-shaded artifact with org.json shading#114
ppatibandla wants to merge 1 commit intomainfrom
feat/shade-org-json

Conversation

@ppatibandla
Copy link
Contributor

Summary

Some enterprise customers have org.json blocked at the JVM level, causing NoClassDefFoundError at runtime. This introduces a new artifact 'java-sdk-shaded' that shades org.json into com.amplitude.shaded.org.json, bundling it directly in the SDK JAR.

The shaded artifact has no external org.json dependency, resolving blocking issues for affected customers. Customers have two migration options:

  1. Update imports from org.json.JSONObject to com.amplitude.shaded.org.json.JSONObject (same API)
  2. Use the Map-based helper methods (setEventProperties, setUserProperties, etc.) that don't expose JSONObject directly

Changes:

  • Add Gradle Shadow plugin to relocate and bundle org.json classes
  • Create new artifact 'java-sdk-shaded' at version 1.13.0
  • Configure publishing to use shaded JAR with no org.json dependency in POM
  • Disable signing for mavenLocal to enable local testing

Checklist

  • [X ] Does your PR title have the correct title format?
  • Does your PR have a breaking change?: Yes

Some enterprise customers have org.json blocked at the JVM level, causing NoClassDefFoundError at runtime. This introduces a new artifact 'java-sdk-shaded' that shades org.json into com.amplitude.shaded.org.json, bundling it directly in the SDK JAR.

The shaded artifact has no external org.json dependency, resolving blocking issues for affected customers. Customers have two migration options:
1. Update imports from org.json.JSONObject to com.amplitude.shaded.org.json.JSONObject (same API)
2. Use the Map-based helper methods (setEventProperties, setUserProperties, etc.) that don't expose JSONObject directly

Changes:
- Add Gradle Shadow plugin to relocate and bundle org.json classes
- Create new artifact 'java-sdk-shaded' at version 1.13.0
- Configure publishing to use shaded JAR with no org.json dependency in POM
- Disable signing for mavenLocal to enable local testing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant