api / org.gradle.kotlin.dsl / exclude

exclude

fun <T : ModuleDependency> T.exclude(group: String? = null, module: String? = null): T

Adds an exclude rule to exclude transitive dependencies of this dependency.

Excluding a particular transitive dependency does not guarantee that it does not show up in the dependencies of a given configuration. For example, some other dependency, which does not have any exclude rules, might pull in exactly the same transitive dependency. To guarantee that the transitive dependency is excluded from the entire configuration please use per-configuration exclude rules: Configuration.getExcludeRules. In fact, in majority of cases the actual intention of configuring per-dependency exclusions is really excluding a dependency from the entire configuration (or classpath).

If your intention is to exclude a particular transitive dependency because you don't like the version it pulls in to the configuration then consider using the forced versions feature: ResolutionStrategy.force.

Parameters

group - the optional group identifying the dependencies to be excluded.

module - the optional module name identifying the dependencies to be excluded.

Return
this

See Also

ModuleDependency.exclude