= mcup(1) :doctype: manpage :release-version: 0.2.3 == NAME mcup - Command line tool to keep your local maven repository small and tidy. == SYNOPSIS *mcup* [_FLAGS_] [_OPTIONS_] _SUBCOMMAND_ == DESCRIPTION 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 which 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. The mcup(1) command 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 two modes: . analyze and report the size of the artifacts selected by the filters . remove all artifacts selected by the filters and keep the rest . keep all artifacts selected by the filters and remove the rest == FLAGS *-r, --releases*:: Selects released artifacts only *-s, --snapshots*:: Selects snapshot artifacts only *-h, --help*:: Prints help information *-V, --version*:: Prints version information == OPTIONS *-g, --groups* _GROUPS_:: Selects artifacts based on the group ID. Subgroups are included by default: + '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'. *-v, --versions* _VERSIONS_:: Selects artifacts based on version (ranges). Use _'..'_ to select the _n_ most recent versions, _'..'_ to select the _n_ oldest versions and _''_ to select one specific version only: + '2..' the two most recent versions '..3' the three oldest versions '1.2.3' exactly version 1.2.3 *-l, --local-repository* _LOCAL_REPOSITORY_:: Sets the location of the local maven repository. Respects the directory configured by __ in '~/.m2/settings.xml'. Falls back to '~/.m2/repository', if nothing has been specified or configured. + Thus, the location of the local repository is computed in this order: . The value of the option _--local-repository_ . The value of __ in '~/.m2/settings.xml' . Fall back to '~/.m2/repository/' == SUBCOMMANDS *du*:: Analyzes 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_. *keep*:: Keeps the artifacts matched by the filters and removes the rest *rm*:: Removes the artifacts matched by the filters and keeps the rest The _keep_ and _rm_ subcommands accepts the following options: *-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 == EXIT STATUS *0*:: Success. *1*:: Unsuccessful program execution. *101*:: The program panicked. == FILTER COMBINATIONS 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. |=== == EXAMPLES Get a quick overview 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 (doesn'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 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* == VERSION {RELEASE-VERSION} == RESOURCES *Homepage:* https://github.com/hpehl/mcup *Source Code:* https://github.com/hpehl/mcup *Issue Tracker:* https://github.com/hpehl/mcup/issues/ == AUTHORS Harald Pehl