Skip to main content

Build Command

Compile Java projects with various output targets and options.
mcmp build [PATH] [OPTIONS]

Options

path
string
Java file or directory to compile (defaults to current directory)
--output, -o
string
Output directory for compiled files
--target, -t
string
Build target: class or jar (default: class)
--classpath, -cp
string
Classpath for compilation
--source, -s
string
Source directory (for multi-file projects)
--main-class, -m
string
Main class (required for jar target)
--jar-name, -j
string
Output jar filename
--watch, -w
boolean
Watch for changes and rebuild automatically

Examples

# Compile current directory
mcmp build

# Compile specific file
mcmp build MyClass.java

# Build JAR with main class
mcmp build --target jar --main-class com.example.Main --jar-name myapp.jar

# Watch mode for development
mcmp build --watch

Run Command

Execute Java applications with flexible configuration.
mcmp run [PATH] [ARGS] [OPTIONS]

Options

path
string
Java file or directory to run (defaults to current directory)
args
string[]
Arguments to pass to the Java application
--classpath, -cp
string
Classpath for execution
--jvm-args
string
JVM arguments
--watch, -w
boolean
Watch for changes and rerun automatically

Examples

# Run current directory
mcmp run

# Run with arguments
mcmp run -- arg1 arg2

# Run with JVM arguments
mcmp run --jvm-args "-Xmx2G -Xms1G"

# Watch mode for development
mcmp run --watch

Add Command

Add dependencies to your project.
mcmp add <DEPENDENCY> [OPTIONS]

Options

dependency
string
required
Dependency name (e.g., “junit”, “org.slf4j:slf4j-api”)
--version, -v
string
Dependency version
--scope
string
Dependency scope: compile, runtime, or test

Examples

# Add JUnit for testing
mcmp add junit --version 5.9.2 --scope test

# Add SLF4J API
mcmp add org.slf4j:slf4j-api --version 2.0.7

# Add runtime dependency
mcmp add com.google.guava:guava --scope runtime

Tree Command

Display the dependency tree for your project.
mcmp tree [OPTIONS]

Options

--direct, -d
boolean
Show only direct dependencies

Examples

# Show full dependency tree
mcmp tree

# Show only direct dependencies
mcmp tree --direct

Repo Command

Add Maven repositories to your project configuration.
mcmp repo <NAME> --url <URL>

Options

name
string
required
Repository name
--url, -u
string
required
Repository URL

Examples

# Add Maven Central
mcmp repo central --url https://repo1.maven.org/maven2/

# Add JCenter
mcmp repo jcenter --url https://jcenter.bintray.com/

# Add custom repository
mcmp repo myrepo --url https://repo.example.com/maven2/

Watch Mode

Both build and run commands support watch mode for development:
  • Build watch: Automatically recompiles when source files change
  • Run watch: Automatically restarts the application when files change
Watch mode is perfect for:
  • Plugin development
  • Server module development
  • Rapid prototyping
  • Testing changes in real-time
# Development workflow
mcmp build --watch    # Terminal 1: Auto-compile
mcmp run --watch      # Terminal 2: Auto-restart