Crates.io | mcup |
lib.rs | mcup |
version | |
source | src |
created_at | 2021-08-03 08:20:26.767906+00 |
updated_at | 2025-04-28 15:56:43.383984+00 |
description | Command line tool to keep your local maven repository small and tidy. |
homepage | https://github.com/hpehl/mcup |
repository | https://github.com/hpehl/mcup |
max_upload_size | |
id | 430850 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
mcup
/m'kʌp/ (maven clean up) is a command line tool to keep your local maven repository small 📦 and tidy
🧹.
Maven is a great tool to build software for Java and other languages running on the JVM. At its core Maven is a dependency manager that downloads and stores dependencies in a local repository. Over time, this repository grows and takes up more and more space on the hard disk. It often contains obsolete versions or dependencies that are no longer needed.
mcup
helps you to clean up your local repository. It uses filters to select artifacts based on the Maven coordinates
groupId
, artifactId
and version
. It knows three modes:
Precompiled binaries are available for macOS, Linux, and Windows.
brew tap hpehl/tap
brew install mcup
cargo install mcup
wget https://github.com/hpehl/mcup/raw/main/completions/mcup.bash -O /etc/bash_completion.d/mcup
source /etc/bash_completion.d/mcup
wget https://github.com/hpehl/mcup/raw/main/completions/_mcup -O /usr/local/share/zsh/site-functions/_mcup
autoload -U compinit && compinit
autoload -U _mcup
wget https://github.com/hpehl/mcup/raw/main/completions/mcup.fish -O ~/.config/fish/completions/mcup.fish
wget https://github.com/hpehl/mcup/raw/main/completions/mcup.elv -O ~/.elvish/lib/mcup.elv
Invoke-WebRequest -Uri https://github.com/hpehl/mcup/raw/main/completions/_mcup.ps1 -OutFile "$HOME\.config\powershell\_mcup.ps1"
. "$HOME\.config\powershell\_mcup.ps1"
mcup [FLAGS] [OPTIONS] <SUBCOMMAND>
-r, --releases
Selects released artifacts only
-s, --snapshots
Selects snapshot artifacts only
-h, --help
Prints help information
-V, --version
Prints version information
-g, --groups <GROUPS>
Selects artifacts based on the group ID.
Subgroups are included by default.
Group | Selection |
---|---|
org | All groups starting with 'org' (including 'org') |
org.wildfly | All groups starting with 'org.wildfly' (includes 'org.wildfly) |
org.wildfly.core | All groups starting with 'org.wildfly.core' (includes 'org.wildfly.core') |
-a, --artifacts <ARTIFACTS>
Selects artifacts based on the artifact ID.
Supports globbing like in maven-*-plugin
(see https://docs.rs/glob/latest/glob/ for more details).
Artifact | Selection |
---|---|
wildfly-core | Artifact 'wildfly-core' only |
*wildfly* | All artifacts containing 'wildfly' |
-v, --versions <VERSIONS>
Selects artifacts based on version (ranges).
Use <n>..
to select the n most recent versions, ..<n>
to select the n oldest versions and <version>
to
select one specific version only.
Version | Selection |
---|---|
1.. | The latest version |
5.. | The 5 most recent versions |
..1 | The oldest version |
..4 | The 4 oldest versions |
1.2.3 | Version 1.2.3 |
-l, --local-repository <LOCAL_REPOSITORY>
Sets the location of the local maven repository.
mcup
respects the configuration of the local repository according
to https://maven.apache.org/guides/mini/guide-configuring-maven.html#configuring-your-local-repository.
The location of the local repository is computed in this order:
--local-repository
<localRepository/>
in ~/.m2/settings.xml
~/.m2/repository/
du
)Use this subcommand to analyze the disk usage of the artifacts selected by the filters. The subcommand accepts the same
filters as the keep
and rm
subcommands, but does not remove any artifacts. Instead, it selects the artifacts matched
by the filters and calculates the size of the groups, artifacts, and versions.
The subcommand accepts the following options:
-o, --output <OUTPUT>
Defines whether (g)roups, (a)rtifacts, and (v)ersions are included in the usage summary.
Defaults to ga
.See the DU page for more information and sample outputs.
keep
, rm
)Use one of these subcommands to remove artifacts selected by the filters:
keep
Keeps the artifacts matched by the filters and removes the restrm
Removes the artifacts matched by the filters and keeps the restThe subcommands accept the following flags:
-d, --dry-run
Does not remove artifacts
--list
Prints the full path to the artifacts that will be removed.
Use this flag together with --dry-run
to review or post-process artifacts that will be removed:
mcup --versions '3..' keep --dry-run --list > artifacts.txt
For subcommands keep
and rm
at least one of --releases
, --snapshots
, --groups
, --artifacts
or--versions
is
required, where --releases
and --snapshots
are mutually exclusive.
Subcommand du
has the same semantics as rm
, but doesn't require a filter.
If --groups
is specified together with any other filter, only artifacts below the matched (sub)groups are
subject to the subcommands (du
, keep
or rm
). Artifacts outside the matched (sub)groups won't be touched.
The following table explains the different filter combinations and describes which artifacts are analyzed, kept, or removed.
Filter | du | keep | rm |
---|---|---|---|
--groups only |
Analyzes the specified (sub)groups. | Keeps the specified (sub)groups and removes anything else. | Removes the specified (sub)groups. |
--artifacts only |
Analyzes the specified artifacts. | Keeps the specified artifacts and removes anything else. | Removes the specified artifacts. |
--versions only |
Analyzes the specified versions. | Keeps the specified versions and removes anything else. | Removes the specified versions. |
--groups plus any other filter |
Analyzes the artifacts matched by the filters below the specified (sub)groups. | Keeps the artifacts matched by the filters below the specified (sub)groups and removes anything else. | Removes the artifacts matched by the filters below the specified (sub)groups and keeps anything else. |
All other combinations w/o --groups |
Analyzes the artifacts matched by the filters. | Keeps the artifacts matched by the filters and removes anything else. | Removes the artifacts matched by the filters. |
Get a quick overview of which groups take the most space
mcup du -og
Show the usage of all artifacts ending with '-build'. Include groups, artifacts, and versions in the usage summary.
mcup --artifacts '*-build' du -ogav
Keep the three most recent versions
mcup --versions '3..' keep
Remove the three oldest versions
mcup --versions '..3' rm
Keep the latest releases (don't touch snapshots)
mcup --releases --version '1..' keep
Remove all snapshots
mcup --snapshots rm
Remove all artifacts starting with group ID 'edu'
mcup --groups edu rm
Keep the latest maven plugins. Don't remove anything outside the group 'org.apache.maven.plugins'
mcup --groups 'org.apache.maven.plugins' --versions '1..' keep
Remove all artifacts (across all groups) starting with 'junit'
mcup --artifacts 'junit*' rm