Fork me on GitHub

dependency:remove

Full name:

org.apache.maven.plugins:maven-dependency-plugin:3.11.0:remove

Description:

Removes a dependency from the project's pom.xml. Supports removing from <dependencies> or <dependencyManagement>.

Matching uses groupId, artifactId, type, and classifier for precision. If the dependency exists in Maven's resolved model but uses property references in the raw POM, a clear error directs the user to edit manually.

When removing a managed dependency from a parent POM, warns if child modules reference it without an explicit version.

Attributes:

  • Requires a Maven project to be executed.
  • The goal is thread-safe and supports parallel builds.
  • Since version: 3.11.0.

Optional Parameters

Name Type Since Description
<classifier> String 3.11.0 Dependency classifier for precise matching (e.g., sources, javadoc, tests).
User Property: classifier
<gav> String 3.11.0 Dependency coordinates: groupId:artifactId[:version] or groupId:artifactId[:extension[:classifier]]:version. Only groupId and artifactId are required. Type and classifier, if provided, are used for precise matching when multiple dependency variants exist (e.g., jar vs test-jar).
User Property: gav
<managed> boolean 3.11.0 When true, remove from <dependencyManagement> instead of <dependencies>.
Default: false
User Property: managed
<profile> String 3.11.0 Target a specific Maven profile by its <id>. When set, the dependency is removed from the profile's <dependencies> or <dependencyManagement> section. The profile must already exist in the POM.
User Property: profile
<silent> boolean 2.0
Deprecated.
to be removed in 4.0; use -q command line option instead

If the plugin should be silent.
Default: false
User Property: silent
<skip> boolean 2.7 Skip plugin execution completely.
Default: false
User Property: mdep.skip
<skipDuringIncrementalBuild> boolean 3.4.0 Skip plugin execution only during incremental builds (e.g. triggered from M2E).
See also: org.apache.maven.plugins.dependency.AbstractDependencyMojo.skip
Default: false
<type> String 3.11.0 Dependency type for precise matching (e.g., pom, war, test-jar). When not specified, defaults to "jar".
User Property: type

Parameter Details

<classifier>

Dependency classifier for precise matching (e.g., sources, javadoc, tests).
  • Type: java.lang.String
  • Since: 3.11.0
  • Required: No
  • User Property: classifier

<gav>

Dependency coordinates: groupId:artifactId[:version] or groupId:artifactId[:extension[:classifier]]:version. Only groupId and artifactId are required. Type and classifier, if provided, are used for precise matching when multiple dependency variants exist (e.g., jar vs test-jar).
  • Type: java.lang.String
  • Since: 3.11.0
  • Required: No
  • User Property: gav

<managed>

When true, remove from <dependencyManagement> instead of <dependencies>.
  • Type: boolean
  • Since: 3.11.0
  • Required: No
  • User Property: managed
  • Default: false

<profile>

Target a specific Maven profile by its <id>. When set, the dependency is removed from the profile's <dependencies> or <dependencyManagement> section. The profile must already exist in the POM.
  • Type: java.lang.String
  • Since: 3.11.0
  • Required: No
  • User Property: profile

<silent>

Deprecated.
to be removed in 4.0; use -q command line option instead

If the plugin should be silent.
  • Type: boolean
  • Since: 2.0
  • Required: No
  • User Property: silent
  • Default: false

<skip>

Skip plugin execution completely.
  • Type: boolean
  • Since: 2.7
  • Required: No
  • User Property: mdep.skip
  • Default: false

<skipDuringIncrementalBuild>

Skip plugin execution only during incremental builds (e.g. triggered from M2E).
See also: org.apache.maven.plugins.dependency.AbstractDependencyMojo.skip
  • Type: boolean
  • Since: 3.4.0
  • Required: No
  • Default: false

<type>

Dependency type for precise matching (e.g., pom, war, test-jar). When not specified, defaults to "jar".
  • Type: java.lang.String
  • Since: 3.11.0
  • Required: No
  • User Property: type