The CLIPropertyKey interface defines the configuration properties specific to the MCReleaser command-line interface.
Package
me.hsgamer.mcreleaser.cli.CLIPropertyKey
Interface Declaration
public interface CLIPropertyKey {
PropertyKey PLATFORMS = new PropertyKey("platforms");
PropertyKey SYNC = new PropertyKey("sync");
PropertyKey FILES = new PropertyKey("files");
}
Property Keys
Specifies which platforms to upload to.
Space-separated list of platform names, or “all” to upload to all configured platforms
Property Key: platforms
Environment Variable: PLATFORMS
Accepted Values:
all - Upload to all configured platforms
github - GitHub Releases only
modrinth - Modrinth only
hangar - Hangar only
polymart - Polymart only
curseforge - CurseForge only
github modrinth - Multiple platforms (space-separated)
Examples:
# Upload to all platforms
export PLATFORMS="all"
# Upload to specific platforms
export PLATFORMS="github modrinth"
# Single platform
export PLATFORMS="github"
String platforms = CLIPropertyKey.PLATFORMS.getValue("all");
// Returns: "github modrinth" or "all"
SYNC
Controls whether platforms upload sequentially or in parallel.
When true, platforms are processed sequentially. When false, platforms run in parallel.
Property Key: sync
Environment Variable: SYNC
Examples:
# Run sequentially (one platform at a time)
export SYNC="true"
# Run in parallel (default)
export SYNC="false"
boolean runSync = CLIPropertyKey.SYNC.asBoolean(false);
// Returns: true or false
Use Cases:
- Parallel (
false): Faster uploads when bandwidth is sufficient
- Sequential (
true): Better for debugging, lower resource usage, or bandwidth-limited environments
FILES
Specifies glob patterns for files to upload.
Space-separated glob patterns matching files to upload
Property Key: files
Environment Variable: FILES
Examples:
# Upload all JARs in build/libs
export FILES="build/libs/*.jar"
# Upload specific file
export FILES="build/libs/my-plugin-1.0.0.jar"
# Multiple patterns
export FILES="build/libs/*-all.jar build/libs/*-sources.jar"
# Nested directories
export FILES="target/**/*.jar"
String fileGlobs = CLIPropertyKey.FILES.getValue();
// Returns: "build/libs/*.jar" or null if not set
Glob Pattern Syntax:
* - Match any characters except directory separator
** - Match any characters including directory separator
? - Match a single character
[abc] - Match any character in brackets
{jar,zip} - Match either extension
Usage in CLIExecutor
The CLI executor uses these properties to configure the upload process:
public static void main(String[] args) {
// Read platform configuration
String platforms = CLIPropertyKey.PLATFORMS.getValue("all");
boolean runSync = CLIPropertyKey.SYNC.asBoolean(false);
BundlePlatform bundlePlatform = new BundlePlatform(platforms, runSync);
// Read file patterns
String fileGlobs = CLIPropertyKey.FILES.getValue();
Validate.check(fileGlobs != null, "File globs not found");
FileBundle fileBundle = PathUtil.getFileBundle(
Paths.get("."),
StringUtil.splitSpace(fileGlobs)
);
// Execute upload
Optional<BatchRunnable> runnable = bundlePlatform.createUploadRunnable(fileBundle);
// ...
}
Complete Configuration Example
#!/bin/bash
# CLI Properties
export PLATFORMS="github modrinth hangar"
export SYNC="false"
export FILES="build/libs/*.jar"
# Common Properties
export NAME="MyPlugin v1.2.0"
export VERSION="1.2.0"
export DESCRIPTION="$(cat CHANGELOG.md)"
export GAME_VERSIONS="1.20 1.20.1 1.20.2"
# Platform-specific properties
export GITHUB_TOKEN="ghp_..."
export GITHUB_REPOSITORY="user/my-plugin"
export GITHUB_REF="refs/tags/v1.2.0"
export MODRINTH_TOKEN="mrp_..."
export MODRINTH_PROJECT="my-plugin"
export MODRINTH_LOADERS="paper spigot"
export HANGAR_KEY="..."
export HANGAR_PROJECT="MyPlugin"
export HANGAR_PLATFORM="paper"
# Run MCReleaser
java -jar mcreleaser-cli.jar
Property Resolution
All CLI properties follow the standard PropertyKey resolution order:
- Environment variable (e.g.,
PLATFORMS)
- System property (e.g.,
-Dplatforms=github)
- Default value (if provided)
null
Validation
Required Validation
The FILES property is validated in CLIExecutor:
String fileGlobs = CLIPropertyKey.FILES.getValue();
Validate.check(fileGlobs != null, "File globs not found");
If FILES is not set, the application throws a validation error.
The PLATFORMS property accepts any value, but only configured platforms will be used. If no platforms are properly configured, the executor throws:
if (optional.isEmpty()) {
throw new RuntimeException("No platform found");
}