What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Maven’s Dependency Plugin to find dependency candidates, not to decide automatically what is safe to delete. Run mvn dependency:analyze, inspect each warning against the POM and resolved dependency tree, then remove candidates individually and run the project’s full verification and packaging workflow. The analyzer examines bytecode, so reflection, framework configuration, and other runtime-loaded uses can escape detection.

What Maven’s dependency analysis tells you

The Apache Maven Dependency Plugin’s dependency:analyze goal sorts dependencies into three useful categories: used and declared, used but undeclared, and unused but declared. The last category is a cleanup lead; the second can reveal a dependency that your code uses but that currently arrives indirectly. Neither category is a complete account of runtime behavior. See the Apache Maven Dependency Plugin overview.

Use dependency:tree to inspect resolved direct and transitive relationships before editing. A library can be present transitively through another dependency even if it is not declared directly; changing a declaration can therefore alter what is available to the project or downstream consumers.

Run the analyzer and inspect its findings

  1. Establish a baseline. Record the current branch or commit, and run the project’s normal verification command before changing the POM. This gives you a meaningful comparison if a build or test later fails.
  2. Review the Maven configuration. Inspect the relevant pom.xml for direct declarations, dependency management, inherited configuration, and active profiles. In a multi-module project, check the module that owns the declaration and the modules that consume it.
  3. Inspect the resolved tree. Run mvn dependency:tree and note whether a candidate is direct, transitive, or present only under a particular profile or scope.
  4. Run standalone analysis. Execute mvn dependency:analyze from the project or module directory. This goal runs test-compile as part of its behavior, so it is not merely a passive report command. Apache documents the distinction in the plugin goal details.
  5. Investigate each warning. Search code and configuration for direct and indirect use, and consider runtime loading, reflection, service loading, annotation processing, generated sources, profiles, and module boundaries before changing anything.
  6. Make a small change and verify it. Remove one candidate or a tightly related group, then run the tests and the project’s normal verification and packaging flow. Check relevant startup and runtime paths as well as compilation.

Why an “unused” warning is not proof

The analyzer relies on bytecode analysis. It may not see a dependency that is loaded reflectively, needed by framework configuration, or required by annotations with source retention. Those are documented limitations in Apache’s guidance on excluding dependencies from analysis. A clean compile alone does not establish that a runtime or packaging path still works.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Apache notes that the plugin does not warn about some dependencies when its analysis is known to be unreliable, “most notably SLF4J.” In other cases, configure a narrow exception only when you understand the reason: an ignored dependency can suppress analysis of a known case, while a forced-used dependency can account for a dependency bytecode analysis cannot recognize. Keep these exceptions documented and reviewable rather than using them to silence broad classes of warnings. The analyze-report configuration documents settings including ignoreNonCompile and usedDependencies.

Choose the right goal for one-off checks or builds

Use case Goal Behavior to account for
Manual, standalone check dependency:analyze Runs test-compile as part of the goal.
Analysis integrated after test compilation dependency:analyze-only Intended for lifecycle use after test-compile has run; it avoids treating the standalone goal as if it were a passive report.

For ongoing checks, Apache’s plugin documentation describes binding analyze-only to a lifecycle phase such as verify and configuring failOnWarning. Before making warnings build failures, resolve known false positives and record justified exceptions; otherwise an incomplete bytecode signal can obstruct routine builds.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How much confidence can dependency cleanup provide?

Confidence comes from combining the analyzer’s signal with project-specific inspection and verification, not from a warning count. A 2020 study, A Comprehensive Study of Bloated Dependencies in the Maven Ecosystem, examined 9,639 Java artifacts and 723,444 dependency relationships. In its intervention, 18 of 21 submitted pull requests were accepted and merged, removing 131 dependencies in total. Those are findings from that study’s dataset and submissions, not a prediction of how many dependencies a particular project can safely remove.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.