Skip to content

Commit

Permalink
Make processDependencyManagementTransitive as false by default
Browse files Browse the repository at this point in the history
Fi: #1002
  • Loading branch information
slawekjaranowski committed Sep 11, 2023
1 parent 0b0fdf8 commit 063250a
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,17 @@ public class MaxDependencyUpdates implements EnforcerRule2 {

/**
* Whether to process the dependencyManagement part transitive or not.
* In case of type {@code pom} and scope {@code import}, this means
* by default to report also the imported dependencies.
* If the parameter is set to {@code false}, the report will only show
* updates of the imported pom itself.
* <p/>
* In case of <code>&lt;type&gt;pom&lt;/type&gt;</code>and
* <code>&lt;scope&gt;import&lt;/scope&gt;</code> this means
* by default the report will only show updates of the imported pom itself.
* <p/>
* If <code>processDependencyManagementTransitive</code> is set to <code>true</code>
* the updates for the imported dependencies are also reported.
*
* @since 2.14.0
*/
protected boolean processDependencyManagementTransitive = true;
protected boolean processDependencyManagementTransitive = false;

/**
* Whether to process the dependencies sections of plugins.
Expand Down
44 changes: 22 additions & 22 deletions versions-enforcer/src/site/markdown/index.md.vm
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,28 @@ This Maven Enforcer rule checks if the number of dependency updates does not exc

The following parameters are supported by this rule:

| Parameter | Default | Description |
|-----------------------------------------------|:----------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `maxUpdates` | `0` | The total maximum allowed number of dependency updates. |
| `processDependencies` | `true` | Whether to process the dependencies section of the project. |
| `processDependencyManagement` | `true` | Whether to process the dependencyManagement section of the project. |
| `processDependencyManagementTransitive` | `true` | Whether to process the dependencyManagement part transitive or not. In case of *type* `pom` and *scope* `import`, this means by default to report also the imported dependencies. If the parameter is set to false the report will only show updates of the imported pom itself. |
| `processPluginDependencies` | `true` | Whether to process the dependencies sections of plugins. |
| `processPluginDependenciesInPluginManagement` | `true` | Whether to process the dependencies sections of plugins which are defined in pluginManagement. |
| `ignoreMinorUpdates` | `false` | Whether minor updates should be ignored. Default `false`.<br/>**Note:** when true, will also assume that `ignoreIncrementalUpdates` and `ignoreSubIncrementalUpdates` are also `true`. |
| `ignoreIncrementalUpdates` | `false` | Whether incremental updates should be ignored. Default `false`.<br/>**Note:** when true, will also assume that `ignoreSubIncrementalUpdates` is also `true`. |
| `ignoreSubIncrementalUpdates` | `false` | Whether sub-incremental updates should be ignored. Default `false`. |
| `dependencyIncludes` | `*` | List of dependency inclusion patterns. Only dependencies matching all the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `dependencyExcludes` | (empty) | List of dependency exclusion patterns. Only dependencies matching none of the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `dependencyManagementIncludes` | `*` | List of dependency management inclusion patterns. Only dependencies matching all the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `dependencyManagementExcludes` | (empty) | List of dependency management exclusion patterns. Only dependencies matching none of the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `pluginDependencyIncludes` | `*` | List of plugin dependency inclusion patterns. Only dependencies matching all the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `pluginDependencyExcludes` | (empty) | List of plugin dependency exclusion patterns. Only dependencies matching none of the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `pluginManagementDependencyIncludes` | `*` | List of plugin management dependency inclusion patterns. Only dependencies matching all the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `pluginManagementDependencyExcludes` | (empty) | List of plugin management dependency exclusion patterns. Only dependencies matching none of the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `serverId` | `serverId` | *settings.xml*'s server id for the URL. This is used when Wagon needs extra authentication information. |
| `rulesUri` | | URI of a ruleSet file containing the rules that control how to compare version numbers. The URI could be either a Wagon URI or a classpath URI (e.g. *classpath:\/\/\/package/sub/package/rules.xml*). |
| `ruleSet` | | Allows specifying the `RuleSet` object describing rules on artifact versions to ignore when considering updates.<br/> See: [Using the ruleSet element in the POM](../versions-maven-plugin/version-rules.html#using-the-ruleset-element-in-the-pom) |
| Parameter | Default | Description |
|-----------------------------------------------|:----------:|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `maxUpdates` | `0` | The total maximum allowed number of dependency updates. |
| `processDependencies` | `true` | Whether to process the dependencies section of the project. |
| `processDependencyManagement` | `true` | Whether to process the dependencyManagement section of the project. |
| `processDependencyManagementTransitive` | `false` | Whether to process the dependencyManagement part transitive or not. In case of *type* `pom` and *scope* `import`, this means by default the report will only show updates of the imported pom itself. If the parameter is set to true the updates for the imported dependencies are also reported. |
| `processPluginDependencies` | `true` | Whether to process the dependencies sections of plugins. |
| `processPluginDependenciesInPluginManagement` | `true` | Whether to process the dependencies sections of plugins which are defined in pluginManagement. |
| `ignoreMinorUpdates` | `false` | Whether minor updates should be ignored. Default `false`.<br/>**Note:** when true, will also assume that `ignoreIncrementalUpdates` and `ignoreSubIncrementalUpdates` are also `true`. |
| `ignoreIncrementalUpdates` | `false` | Whether incremental updates should be ignored. Default `false`.<br/>**Note:** when true, will also assume that `ignoreSubIncrementalUpdates` is also `true`. |
| `ignoreSubIncrementalUpdates` | `false` | Whether sub-incremental updates should be ignored. Default `false`. |
| `dependencyIncludes` | `*` | List of dependency inclusion patterns. Only dependencies matching all the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `dependencyExcludes` | (empty) | List of dependency exclusion patterns. Only dependencies matching none of the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `dependencyManagementIncludes` | `*` | List of dependency management inclusion patterns. Only dependencies matching all the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `dependencyManagementExcludes` | (empty) | List of dependency management exclusion patterns. Only dependencies matching none of the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `pluginDependencyIncludes` | `*` | List of plugin dependency inclusion patterns. Only dependencies matching all the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `pluginDependencyExcludes` | (empty) | List of plugin dependency exclusion patterns. Only dependencies matching none of the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `pluginManagementDependencyIncludes` | `*` | List of plugin management dependency inclusion patterns. Only dependencies matching all the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `pluginManagementDependencyExcludes` | (empty) | List of plugin management dependency exclusion patterns. Only dependencies matching none of the patterns will be considered.<br/>The wildcard (`*`) can be used as the only, first, last or both characters in each token. The version token does support version ranges. |
| `serverId` | `serverId` | *settings.xml*'s server id for the URL. This is used when Wagon needs extra authentication information. |
| `rulesUri` | | URI of a ruleSet file containing the rules that control how to compare version numbers. The URI could be either a Wagon URI or a classpath URI (e.g. *classpath:\/\/\/package/sub/package/rules.xml*). |
| `ruleSet` | | Allows specifying the `RuleSet` object describing rules on artifact versions to ignore when considering updates.<br/> See: [Using the ruleSet element in the POM](../versions-maven-plugin/version-rules.html#using-the-ruleset-element-in-the-pom) |

**Note:** Inclusion/exclusion parameters like `dependencyIncludes`, `dependencyExcludes`, etc. work the same way as parameters
of the same name of the [versions:display-dependency-updates](../versions-maven-plugin/display-dependency-updates-mojo.html) goal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
import org.apache.maven.model.Model;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
import org.apache.maven.repository.RepositorySystem;
Expand Down Expand Up @@ -72,6 +73,7 @@ public void testRuleFailsByMaxUpdatesExceeded() throws ExpressionEvaluationExcep
setDependencies(asList(
dependencyWith("group", "artifactA", "1.0.0"),
dependencyWith("group", "artifactB", "1.0.0")));
setOriginalModel(new Model());
}
},
mockAetherRepositorySystem(new HashMap<String, String[]>() {
Expand Down Expand Up @@ -100,6 +102,7 @@ public void testRulePassesByMaxUpdatesNotExceeded() throws ExpressionEvaluationE
new MavenProject() {
{
setDependencies(singletonList(dependencyWith("group", "artifactA", "1.0.0")));
setOriginalModel(new Model());
}
},
mockAetherRepositorySystem(singletonMap("artifactA", new String[] {"1.0.0", "2.0.0"})));
Expand All @@ -124,6 +127,7 @@ public void testRulePassesByMaxUpdatesNotExceededDependencyIncludes()
setDependencies(asList(
dependencyWith("group", "artifactA", "1.0.0"),
dependencyWith("group", "artifactB", "1.0.0")));
setOriginalModel(new Model());
}
},
mockAetherRepositorySystem(new HashMap<String, String[]>() {
Expand Down Expand Up @@ -153,6 +157,7 @@ public void testRulePassesByMaxUpdatesNotExceededDependencyExcludes()
setDependencies(asList(
dependencyWith("group", "artifactA", "1.0.0"),
dependencyWith("group", "artifactB", "1.0.0")));
setOriginalModel(new Model());
}
},
mockAetherRepositorySystem(new HashMap<String, String[]>() {
Expand Down Expand Up @@ -182,6 +187,7 @@ public void testRulePassesByMaxUpdatesNotExceededDependencyIncludesExcludes()
setDependencies(asList(
dependencyWith("group", "artifactA", "1.0.0"),
dependencyWith("group", "artifactB", "1.0.0")));
setOriginalModel(new Model());
}
},
mockAetherRepositorySystem(new HashMap<String, String[]>() {
Expand Down Expand Up @@ -209,6 +215,7 @@ public void testIgnoreSubIncrementalUpdates() throws ExpressionEvaluationExcepti
new MavenProject() {
{
setDependencies(singletonList(dependencyWith("group", "artifactA", "1.0.0")));
setOriginalModel(new Model());
}
},
mockAetherRepositorySystem(singletonMap("artifactA", new String[] {"1.0.0", "1.0.0-1"})));
Expand All @@ -230,6 +237,7 @@ public void testIgnoreIncrementalUpdates() throws ExpressionEvaluationException,
new MavenProject() {
{
setDependencies(singletonList(dependencyWith("group", "artifactA", "1.0.0")));
setOriginalModel(new Model());
}
},
mockAetherRepositorySystem(singletonMap("artifactA", new String[] {"1.0.0", "1.0.0-1", "1.0.1"})));
Expand All @@ -251,6 +259,7 @@ public void testIgnoreMinorUpdates() throws ExpressionEvaluationException, Compo
new MavenProject() {
{
setDependencies(asList(dependencyWith("group", "artifactA", "1.0.0")));
setOriginalModel(new Model());
}
},
mockAetherRepositorySystem(
Expand Down
Loading

0 comments on commit 063250a

Please sign in to comment.