On this page
Maven and Gradle release target supporting version management across pom.xml, build.gradle, build.gradle.kts, and gradle.properties files.
#rlsbl.targets.maven
#rlsbl.targets.maven
Maven and Gradle release target supporting version management across pom.xml, build.gradle, build.gradle.kts, gradle.properties, and gradle/libs.versions.toml files.
#MavenTarget
Release target for Maven/Gradle (Java/Kotlin) projects.
#name
def name(self)#_read_project_name
def _read_project_name(self, dir_path)Extract project name from pom.xml, build.gradle.kts, or build.gradle.
Returns the name string if found, or None.
#read_name
def read_name(self, dir_path, ctx)Read the project name (groupId:artifactId or group) from build files.
#read_metadata
def read_metadata(self, dir_path)Read metadata from pom.xml, build.gradle.kts, or build.gradle.
Extracts available fields:
- POM: groupId, artifactId, version, name, description, url, licenses
- Gradle: group, version, description
Returns a dict with string keys and values. Only fields that are present in the build file are included.
#_read_pom_metadata
def _read_pom_metadata(self, pom_path)Extract metadata from a pom.xml file.
#_read_gradle_metadata
def _read_gradle_metadata(gradle_path, *, kts)Extract metadata from a build.gradle or build.gradle.kts file.
#_is_android_app
def _is_android_app(self, dir_path)Check if a gradle file declares the Android application plugin.
#detect
def detect(self, dir_path)Detect if dir has build.gradle.kts, build.gradle, or pom.xml.
Returns False for Android application projects (those use native-android).
#_load_version_catalog_key
def _load_version_catalog_key(dir_path)Load the version_catalog_key from .rlsbl/config.json.
Returns the key string or raises VersionError if not configured.
#_find_version_file
def _find_version_file(self, dir_path)Return (filepath, format) tuple for the version source.
#_read_version_catalog
def _read_version_catalog(self, dir_path, catalog_path)Read version from a Gradle version catalog (libs.versions.toml).
Requires version_catalog_key in .rlsbl/config.json to specify which [versions] entry holds the project version.
#_write_version_catalog
def _write_version_catalog(self, dir_path, catalog_path, version)Write version to a Gradle version catalog (libs.versions.toml).
Returns the relative path of the modified file.
#read_version
def read_version(self, dir_path)Read version from the detected version source.
#write_version
def write_version(self, dir_path, version, ctx)Write version to the same file it was read from.
Returns a list of relative file paths (relative to dir_path) that were modified.
#version_file
def version_file(self, dir_path=None)#tag_format
def tag_format(self, version)#template_dir
def template_dir(self)#template_vars
def template_vars(self, dir_path, ctx)Extract template variables from the project.
#template_mappings
def template_mappings(self, ctx)#check_project_exists
def check_project_exists(self, dir_path)#get_project_init_hint
def get_project_init_hint(self)#build
def build(self, dir_path, version)Run the project build step.
Uses ./gradlew build for Gradle projects, mvn package for Maven.
#detect_lint_command
def detect_lint_command(dir_path)Detect the appropriate lint command for a Gradle project.
Checks build.gradle.kts and build.gradle for lint plugins:
- detekt plugin -> ./gradlew detekt
- checkstyle plugin -> ./gradlew checkstyleMain
- neither -> ./gradlew check (fallback)
Returns a list of command args, or None if no Gradle wrapper found.