Skip to content

build: publish AAR + sources via maven-publish for JitPack consumption - #11

Merged
KaustubhNBhangre merged 1 commit into
mainfrom
build/maven-publish-jitpack
Aug 10, 2026
Merged

build: publish AAR + sources via maven-publish for JitPack consumption#11
KaustubhNBhangre merged 1 commit into
mainfrom
build/maven-publish-jitpack

Conversation

@Devild007

Copy link
Copy Markdown
Contributor

Summary

  • Add the maven-publish plugin to featbit-client and featbit-client-android, and declare a MavenPublication("release") on top of the existing AGP singleVariant("release") { withSourcesJar() } block
  • Populate coordinates from GROUP + VERSION_NAME in gradle.properties (co.featbit:*:0.1.0-SNAPSHOT locally)
  • Prefer JitPack's VERSION environment variable over the gradle property at build time so the file names on disk match the tag JitPack is building (JitPack looks up <artifact>-<tag>.aar, not <artifact>-0.1.0-SNAPSHOT.aar)
  • Enrich generated POMs with name, description, url, licenses (Apache-2.0), and scm blocks — accepted by JitPack today, and by Maven Central or a private registry if the artifact is ever republished
  • Add jitpack.yml pinning openjdk17 (matching the existing CI workflow) and pointing JitPack at the two-module publishToMavenLocal invocation
  • Update README.md's Installation section to document the real JitPack coordinate (com.github.Fluent-Health.featbit-android-sdk:<module>:<tag>) instead of the earlier co.featbit:featbit-client:<version> placeholder

Why

Consumers cannot pin a version of this SDK today: they either take a source-level git submodule dependency, drop a locally-built AAR into libs/, or fall back to the placeholder coordinate. None scale past a single consumer. Publishing via JitPack costs no additional infrastructure — a git tag on this repository is enough — and keeps the door open for Maven Central or a private registry later without changing consumer code.

Verified locally

  • ./gradlew :featbit-client:publishToMavenLocal :featbit-client-android:publishToMavenLocal publishes co.featbit:featbit-client:0.1.0-SNAPSHOT and co.featbit:featbit-client-android:0.1.0-SNAPSHOT with AAR + sources jar + POM to ~/.m2
  • VERSION=v0.1.0 ./gradlew :featbit-client:publishToMavenLocal :featbit-client-android:publishToMavenLocal simulates a JitPack build for tag v0.1.0: the files come out as featbit-client-v0.1.0.aar etc. and every POM entry (parent module, cross-module transitive) declares the same version
  • featbit-client-android's POM correctly declares a compile-scope dependency on featbit-client at the same version — JitPack rewrites the group to com.github.Fluent-Health.featbit-android-sdk at serve time as part of its multi-module handling

Consumer wire-up once the first tag lands

// settings.gradle.kts (in a consumer project)
dependencyResolutionManagement {
    repositories {
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

// build.gradle.kts (in a consumer module)
dependencies {
    implementation("com.github.Fluent-Health.featbit-android-sdk:featbit-client:v0.1.0")
    // Optional Android lifecycle glue, depends on `featbit-client` transitively.
    implementation("com.github.Fluent-Health.featbit-android-sdk:featbit-client-android:v0.1.0")
}

Out of scope

  • A dedicated publish job in CI. JitPack builds on demand per tag, so no locally-driven publish workflow is required. If Maven Central becomes the target later, GPG signing and a release workflow can be added at that point
  • Version-bump automation. VERSION_NAME in gradle.properties is only the local fallback; a real release is a git tag, which is the JitPack contract

Test plan

  • ./gradlew :featbit-client:publishToMavenLocal :featbit-client-android:publishToMavenLocal succeeds; inspect ~/.m2/repository/co/featbit/…/*.pom for metadata
  • VERSION=v0.1.0 ./gradlew :featbit-client:publishToMavenLocal :featbit-client-android:publishToMavenLocal produces -v0.1.0 artifact names and version entries in every POM
  • After merge, tag v0.1.0 on this branch and request the artifact from JitPack in a scratch Android project; confirm assembleDebug resolves both modules including the transitive dependency

Wire both library modules for artifact publication so downstream consumers can
depend on a pinned version instead of a git submodule or an ad-hoc AAR drop.
The same publication block will later target Maven Central or a private
registry without changing consumer coordinates.

- `featbit-client` and `featbit-client-android` gain the `maven-publish`
  plugin and a `MavenPublication("release")` bound to the existing AGP
  `singleVariant("release") { withSourcesJar() }` block. Generated POMs get
  the usual `name`/`description`/`url`/`licenses` (Apache-2.0)/`scm` blocks.
- Coordinates come from `GROUP` and `VERSION_NAME` in `gradle.properties`.
  The publication `version` prefers JitPack's `VERSION` env var over the
  gradle property so the file names on disk match the tag JitPack asked for
  (JitPack looks up `<artifact>-<tag>.aar`, not `<artifact>-0.1.0-SNAPSHOT.aar`).
- New `jitpack.yml` pins the build JDK to 17 (matching CI) and points JitPack
  at the two-module `publishToMavenLocal` invocation so it produces both
  artifacts + their sources jar + POM in one pass.
- `README.md` `Installation` section now documents the real JitPack coordinate
  (`com.github.Fluent-Health.featbit-android-sdk:<module>:<tag>`) instead of
  the earlier `co.featbit:*:<version>` placeholder.

Verified locally: bare `./gradlew publishToMavenLocal` publishes
`co.featbit:*:0.1.0-SNAPSHOT`, and `VERSION=v0.1.0 ./gradlew publishToMavenLocal`
publishes `v0.1.0` end-to-end (parent + cross-module transitive POM entries).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@KaustubhNBhangre
KaustubhNBhangre merged commit 846b78e into main Aug 10, 2026
5 checks passed
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.

2 participants