Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Kafka Gradle Maven Publish

From Leeroopedia


Knowledge Sources
Domains Release_Engineering, Build_Systems
Last Updated 2026-02-09 12:00 GMT

Overview

Concrete tool for publishing JAR artifacts to Apache Maven staging via Gradle provided by the Kafka release orchestration.

Description

The Maven publish step is orchestrated through the runtime.cmd function which executes Gradle's publish task. The Gradle build is configured with signing credentials and the Apache Maven staging repository URL. The release.py script coordinates this step as part of the overall release workflow.

Usage

This step is invoked automatically as part of the release stage command. It requires Gradle build configuration with Maven publishing and signing plugins, plus valid Apache repository credentials.

Code Reference

Source Location

  • Repository: Apache Kafka
  • File: release/release.py (L280-320), release/runtime.py (L109-146)

Signature

# Invoked via runtime.cmd:
cmd("Publishing Maven artifacts...",
    "gradlew publish -PmavenUrl=https://repository.apache.org/service/local/staging/deploy/maven2 ...")

def cmd(action, cmd_arg, *args, **kwargs):
    """
    Execute an external command with retry on failure.
    Returns True on success, False if allow_failure=True and command failed.
    """

Import

from runtime import cmd

I/O Contract

Inputs

Name Type Required Description
action str Yes Description of the publish action
cmd_arg str Yes Gradle publish command with signing config
Maven credentials env Yes Repository username/password
GPG credentials env Yes Signing key and passphrase

Outputs

Name Type Description
cmd returns bool True if publish succeeded
Maven artifacts remote JARs published to repository.apache.org staging

Usage Examples

Publish to Maven Staging

from runtime import cmd

cmd("Publishing Maven artifacts to staging repository",
    "./gradlew publish "
    "-PmavenUrl=https://repository.apache.org/service/local/staging/deploy/maven2 "
    "-PmavenUsername=$MAVEN_USER "
    "-PmavenPassword=$MAVEN_PASS")

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment