Repository: mojohaus/versions (java)

Issue:
Too aggressive logging of `Assuming allowMajorUpdates false because allowMinorUpdates is false`
I have a project utilize the goal `display-dependency-updates` to check minor and incremental dependency updates. The config has explicitly set `allowMajorUpdates` to false, but on running
the goal the plugin still emit lots of `Assuming allowMajorUpdates false because allowMinorUpdates is false`.

```
[INFO] --- versions:2.17.1:display-dependency-updates (default) @ foo ---
[INFO] Assuming allowMajorUpdates false because allowMinorUpdates is false.
[INFO] Assuming allowMajorUpdates false because allowMinorUpdates is false.
[INFO] Assuming allowMajorUpdates false because allowMinorUpdates is false.
[INFO] Assuming allowMajorUpdates false because allowMinorUpdates is false.
[INFO] Assuming allowMajorUpdates false because allowMinorUpdates is false.
[INFO] Assuming allowMajorUpdates false because allowMinorUpdates is false.
[INFO] Assuming allowMajorUpdates false because allowMinorUpdates is false.
...
```

I think those logging can be omitted if user set `allowMajorUpdates` to false explicitly.

Pull request description:
Resolves #1131: Suppress logging when allowMajorUpdates, allowMinorUp…
…dates and allowIncrementalUpdates are in valid combination

Patch:
diff --git a/pom.xml b/pom.xml
index b4dc72f6..ce6df1f9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,7 +129,7 @@
     <fluidoVersion>${maven-fluido-skin.version}</fluidoVersion>
     <modelloNamespaceRuleVersion>2.1.0</modelloNamespaceRuleVersion>
     <modelloNamespaceReportVersion>2.0.0</modelloNamespaceReportVersion>
-    <byteBuddyVersion>1.14.19</byteBuddyVersion>
+    <byteBuddyVersion>1.15.1</byteBuddyVersion>
     <!-- use the same version as in Maven core -->
     <mavenResolverVersion>1.4.1</mavenResolverVersion>
 
@@ -280,7 +280,7 @@
       <dependency>
         <groupId>org.apache.commons</groupId>
         <artifactId>commons-lang3</artifactId>
-        <version>3.16.0</version>
+        <version>3.17.0</version>
       </dependency>
       <dependency>
         <groupId>org.apache.maven.plugin-testing</groupId>
diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java b/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java
index b3e19123..3f0f8c0f 100644
--- a/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java
+++ b/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java
@@ -471,6 +471,7 @@ public final class PomHelper {
      * @param oldVersion The old version of the dependency.
      * @param newVersion The new version of the dependency.
      * @param model      The model to getModel the project properties from.
+     * @param logger     The logger to use.
      * @return <code>true</code> if a replacement was made.
      * @throws XMLStreamException if something went wrong.
      */
@@ -481,7 +482,8 @@ public final class PomHelper {
             final String artifactId,
             final String oldVersion,
             final String newVersion,
-            final Model model)
+            final Model model,
+            final Log logger)
             throws XMLStreamException {
         Stack<String> stack = new Stack<>();
         String path = "";
@@ -564,11 +566,11 @@ public final class PomHelper {
                         && PATTERN_PROJECT_DEPENDENCY_VERSION.matcher(path).matches()) {
                     if ("groupId".equals(elementName)) {
                         haveGroupId =
-                                groupId.equals(evaluate(pom.getElementText().trim(), implicitProperties));
+                                groupId.equals(evaluate(pom.getElementText().trim(), implicitProperties, logger));
                         path = stack.pop();
                     } else if ("artifactId".equals(elementName)) {
                         haveArtifactId =
-                                artifactId.equals(evaluate(pom.getElementText().trim(), implicitProperties));
+                                artifactId.equals(evaluate(pom.getElementText().trim(), implicitProperties, logger));
                         path = stack.pop();
                     } else if ("version".equals(elementName)) {
                         pom.mark(0);
@@ -617,9 +619,10 @@ public final class PomHelper {
      *
      * @param expr       The expression to evaluate.
      * @param properties The properties to substitute.
+     * @param logger  The logger to use.
      * @return The evaluated expression.
      */
-    public static String evaluate(String expr, Map<String, String> properties) {
+    public static String evaluate(String expr, Map<String, String> properties, Log logger) {
         if (expr == null) {
             return null;
         }
@@ -634,15 +637,15 @@ public final class PomHelper {
                         if (exprStartDelimiter >= 0) {
                             if (exprStartDelimiter > 0) {
                                 value = value.substring(0, exprStartDelimiter)
-                                        + evaluate(value.substring(exprStartDelimiter), properties);
+                                        + evaluate(value.substring(exprStartDelimiter), properties, logger);
                             } else {
-                                value = evaluate(value.substring(exprStartDelimiter), properties);
+                                value = evaluate(value.substring(exprStartDelimiter), properties, logger);
                             }
                         }
                     } else {
-                        // TODO find a way to log that and not use this System.out!!
-                        // this class could be a component with logger injected !!
-                        System.out.println("expression: " + expression + " no value ");
+                        // Because we work with the raw model, without interpolation, unevaluatable expressions are not
+                        // unexpected
+                        logger.debug("expression: " + expression + " no value ");
                     }
                     return value == null ? expr : value;
                 })
@@ -656,10 +659,10 @@ public final class PomHelper {
                             if (index > 0 && expr.charAt(index - 1) == '$') {
                                 retVal += expr.substring(index + 1, lastIndex + 1);
                             } else {
-                                retVal += evaluate(expr.substring(index, lastIndex + 1), properties);
+                                retVal += evaluate(expr.substring(index, lastIndex + 1), properties, logger);
                             }
 
-                            retVal += evaluate(expr.substring(lastIndex + 1), properties);
+                            retVal += evaluate(expr.substring(lastIndex + 1), properties, logger);
                             return retVal;
                         }
                     }
diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java b/versions-common/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java
index c1a46f16..1a357e39 100644
--- a/versions-common/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java
+++ b/versions-common/src/main/java/org/codehaus/mojo/versions/change/AbstractVersionChanger.java
@@ -34,7 +34,7 @@ public abstract class AbstractVersionChanger implements VersionChanger {
 
     private final ModifiedPomXMLEventReader pom;
 
-    private final Log log;
+    protected final Log log;
 
     public AbstractVersionChanger(Model model, ModifiedPomXMLEventReader pom, Log log) {
         this.model = model;
diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java b/versions-common/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java
index 5375de50..03fd6581 100644
--- a/versions-common/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java
+++ b/versions-common/src/main/java/org/codehaus/mojo/versions/change/DependencyVersionChanger.java
@@ -42,7 +42,8 @@ public class DependencyVersionChanger extends AbstractVersionChanger {
                 versionChange.getArtifactId(),
                 versionChange.getOldVersion(),
                 versionChange.getNewVersion(),
-                getModel())) {
+                getModel(),
+                log)) {
             info("    Updating dependency " + versionChange.getGroupId() + ":" + versionChange.getArtifactId());
             info("        from version " + versionChange.getOldVersion() + " to " + versionChange.getNewVersion());
         }
diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java b/versions-common/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java
index 9de82625..9c4c53f3 100644
--- a/versions-common/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java
+++ b/versions-common/src/main/java/org/codehaus/mojo/versions/utils/SegmentUtils.java
@@ -64,11 +64,11 @@ public class SegmentUtils {
      */
     public static Optional<Segment> determineUnchangedSegment(
             boolean allowMajorUpdates, boolean allowMinorUpdates, boolean allowIncrementalUpdates, Log log) {
-        if (log != null && !allowIncrementalUpdates) {
+        if (log != null && !allowIncrementalUpdates && allowMinorUpdates) {
             log.info("Assuming allowMinorUpdates false because allowIncrementalUpdates is false.");
         }
 
-        if (log != null && !allowMinorUpdates) {
+        if (log != null && !allowMinorUpdates && allowMajorUpdates) {
             log.info("Assuming allowMajorUpdates false because allowMinorUpdates is false.");
         }
 
diff --git a/versions-maven-plugin/src/it-repo/it-resolve-ranges-issue-1121-parent.pom b/versions-maven-plugin/src/it-repo/it-resolve-ranges-issue-1121-parent.pom
new file mode 100644
index 00000000..da57e65c
--- /dev/null
+++ b/versions-maven-plugin/src/it-repo/it-resolve-ranges-issue-1121-parent.pom
@@ -0,0 +1,22 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>localhost</groupId>
+  <artifactId>it-resolve-ranges-issue-1121-parent</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <dummy.api.version>1.1.1</dummy.api.version>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>localhost</groupId>
+      <artifactId>dummy-api</artifactId>
+      <version>${dummy.api.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>
diff --git a/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/invoker.properties b/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/invoker.properties
new file mode 100644
index 00000000..bdb73fc3
--- /dev/null
+++ b/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/invoker.properties
@@ -0,0 +1,1 @@
+invoker.goals=-X ${project.groupId}:${project.artifactId}:${project.version}:resolve-ranges
diff --git a/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/pom.xml b/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/pom.xml
new file mode 100644
index 00000000..38e70793
--- /dev/null
+++ b/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/pom.xml
@@ -0,0 +1,19 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>localhost</groupId>
+    <artifactId>it-resolve-ranges-issue-1121-parent</artifactId>
+    <version>1.0</version>
+  </parent>
+  <artifactId>it-resolve-ranges-issues-1121</artifactId>
+  <packaging>pom</packaging>
+  <name>resolve-ranges IT issue 1121</name>
+
+  <description>Test that resolve-ranges recognizes a property that overrides a property in its parent that is used as a version itself</description>
+
+  <properties>
+    <dummy.api.version>[1,3.0)</dummy.api.version>
+  </properties>
+</project>
diff --git a/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/verify.bsh b/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/verify.bsh
new file mode 100644
index 00000000..82ecabcd
--- /dev/null
+++ b/versions-maven-plugin/src/it/it-resolve-ranges-issue-1121/verify.bsh
@@ -0,0 +1,21 @@
+import java.io.*;
+import org.codehaus.plexus.util.FileUtils;
+
+try
+{
+    File file = new File( basedir, "pom.xml" );
+    String buf = FileUtils.fileRead( file, "UTF-8" );
+
+    if ( buf.indexOf( "<dummy.api.version>2.1</dummy.api.version>" ) < 0 ) 
+    {
+        System.err.println( "Version of dummy-api not resolved" );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;
diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java
index 26b3ed9f..0994cd94 100644
--- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java
+++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/AbstractVersionsDependencyUpdaterMojo.java
@@ -561,7 +561,8 @@ public abstract class AbstractVersionsDependencyUpdaterMojo extends AbstractVers
                 dep.getArtifactId(),
                 dep.getVersion(),
                 newVersion,
-                getProject().getModel())) {
+                getProject().getModel(),
+                getLog())) {
             if (getLog().isInfoEnabled()) {
                 getLog().info("Updated " + toString(dep) + " to version " + newVersion);
             }
diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayExtensionUpdatesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayExtensionUpdatesMojo.java
index 663cbc05..370076b3 100644
--- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayExtensionUpdatesMojo.java
+++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/DisplayExtensionUpdatesMojo.java
@@ -233,9 +233,10 @@ public class DisplayExtensionUpdatesMojo extends AbstractVersionsDisplayMojo {
                                         .orElse(Collections.emptyList())
                                         .stream()
                                         .map(e -> ExtensionBuilder.newBuilder()
-                                                .withGroupId(PomHelper.evaluate(e.getGroupId(), properties))
-                                                .withArtifactId(PomHelper.evaluate(e.getArtifactId(), properties))
-                                                .withVersion(PomHelper.evaluate(e.getVersion(), properties))
+                                                .withGroupId(PomHelper.evaluate(e.getGroupId(), properties, getLog()))
+                                                .withArtifactId(
+                                                        PomHelper.evaluate(e.getArtifactId(), properties, getLog()))
+                                                .withVersion(PomHelper.evaluate(e.getVersion(), properties, getLog()))
                                                 .build()));
                     }
                 }
diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LockSnapshotsMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LockSnapshotsMojo.java
index d00151b8..1351b110 100644
--- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LockSnapshotsMojo.java
+++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/LockSnapshotsMojo.java
@@ -134,7 +134,8 @@ public class LockSnapshotsMojo extends AbstractVersionsDependencyUpdaterMojo {
                             dep.getArtifactId(),
                             version,
                             lockedVersion.get(),
-                            getProject().getModel())) {
+                            getProject().getModel(),
+                            getLog())) {
                         getLog().info("Locked " + toString(dep) + " to version " + lockedVersion.get());
                     }
                 } else {
diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java
index 8b12b5ca..a1766296 100644
--- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java
+++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/ResolveRangesMojo.java
@@ -25,8 +25,10 @@ import javax.xml.stream.XMLStreamException;
 import java.util.Collection;
 import java.util.Map;
 import java.util.Optional;
+import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.maven.artifact.Artifact;
@@ -261,7 +263,8 @@ public class ResolveRangesMojo extends AbstractVersionsDependencyUpdaterMojo {
                                 artifact.getArtifactId(),
                                 dep.getVersion(),
                                 artifactVersion,
-                                getProject().getModel())) {
+                                getProject().getModel(),
+                                getLog())) {
                             getLog().debug("Version set to " + artifactVersion + " for dependency: " + artifact);
                         } else {
                             getLog().debug("Could not find the version tag for dependency " + artifact + " in project "
@@ -277,6 +280,11 @@ public class ResolveRangesMojo extends AbstractVersionsDependencyUpdaterMojo {
     private void resolvePropertyRanges(ModifiedPomXMLEventReader pom)
             throws XMLStreamException, MojoExecutionException {
 
+        if (includeProperties == null) {
+            Properties originalProperties = getProject().getOriginalModel().getProperties();
+            includeProperties =
+                    originalProperties.stringPropertyNames().stream().collect(Collectors.joining(","));
+        }
         Map<Property, PropertyVersions> propertyVersions = this.getHelper()
                 .getVersionPropertiesMap(VersionsHelper.VersionPropertiesMapRequest.builder()
                         .withMavenProject(getProject())
diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UnlockSnapshotsMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UnlockSnapshotsMojo.java
index 1839a52f..979cff07 100644
--- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UnlockSnapshotsMojo.java
+++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UnlockSnapshotsMojo.java
@@ -129,7 +129,8 @@ public class UnlockSnapshotsMojo extends AbstractVersionsDependencyUpdaterMojo {
                         dep.getArtifactId(),
                         dep.getVersion(),
                         unlockedVersion,
-                        getProject().getModel())) {
+                        getProject().getModel(),
+                        getLog())) {
 
                     getChangeRecorder()
                             .recordChange(DefaultDependencyChangeRecord.builder()
diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReactorMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReactorMojo.java
index 8594c2ac..0808ce08 100644
--- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReactorMojo.java
+++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseReactorMojo.java
@@ -110,7 +110,8 @@ public class UseReactorMojo extends AbstractVersionsDependencyUpdaterMojo {
                             dep.getArtifactId(),
                             dep.getVersion(),
                             project.getVersion(),
-                            getProject().getModel())) {
+                            getProject().getModel(),
+                            getLog())) {
                         getLog().info("Updated " + toString(dep) + " to version " + project.getVersion());
                     }
                     break;


Test patch:
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ForceReleasesMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ForceReleasesMojoTest.java
index 6e610b33..72944e7d 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ForceReleasesMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/ForceReleasesMojoTest.java
@@ -118,7 +118,7 @@ public class ForceReleasesMojoTest extends AbstractMojoTestCase {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -145,7 +145,7 @@ public class ForceReleasesMojoTest extends AbstractMojoTestCase {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -172,7 +172,7 @@ public class ForceReleasesMojoTest extends AbstractMojoTestCase {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -201,7 +201,7 @@ public class ForceReleasesMojoTest extends AbstractMojoTestCase {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/LockSnapshotsMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/LockSnapshotsMojoTest.java
index 1f7f8fdd..e4b78d2f 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/LockSnapshotsMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/LockSnapshotsMojoTest.java
@@ -89,7 +89,7 @@ public class LockSnapshotsMojoTest {
         LockSnapshotsMojo mojo = createMojo(repositorySystem);
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenThrow(new RuntimeException("Not supposed to modify the dependency"));
             mojo.lockSnapshots(null, mojo.project.getDependencies());
         }
@@ -103,7 +103,7 @@ public class LockSnapshotsMojoTest {
         LockSnapshotsMojo mojo = createMojo(repositorySystem);
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenThrow(new RuntimeException("Not supposed to modify the dependency"));
             mojo.lockSnapshots(null, mojo.project.getDependencies());
         }
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseLatestReleasesMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseLatestReleasesMojoTest.java
index d04ca85e..2c2301eb 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseLatestReleasesMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseLatestReleasesMojoTest.java
@@ -106,7 +106,7 @@ public class UseLatestReleasesMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -135,7 +135,7 @@ public class UseLatestReleasesMojoTest {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -167,7 +167,7 @@ public class UseLatestReleasesMojoTest {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseLatestVersionsMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseLatestVersionsMojoTest.java
index 6c11c148..89f1b2ab 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseLatestVersionsMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseLatestVersionsMojoTest.java
@@ -129,7 +129,7 @@ public class UseLatestVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
@@ -157,7 +157,7 @@ public class UseLatestVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
@@ -181,7 +181,7 @@ public class UseLatestVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
@@ -208,7 +208,7 @@ public class UseLatestVersionsMojoTest {
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
                     .thenReturn(mojo.getProject().getModel());
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
@@ -242,7 +242,7 @@ public class UseLatestVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
@@ -283,7 +283,7 @@ public class UseLatestVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
@@ -304,7 +304,7 @@ public class UseLatestVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
@@ -327,7 +327,7 @@ public class UseLatestVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
@@ -353,7 +353,7 @@ public class UseLatestVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             mojo.update(null);
         }
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseNextReleasesMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseNextReleasesMojoTest.java
index 75d170c2..2849c4bc 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseNextReleasesMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseNextReleasesMojoTest.java
@@ -93,7 +93,7 @@ public class UseNextReleasesMojoTest {
     public void testNoNewerReleases() {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -114,7 +114,7 @@ public class UseNextReleasesMojoTest {
         }));
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -147,7 +147,7 @@ public class UseNextReleasesMojoTest {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -179,7 +179,7 @@ public class UseNextReleasesMojoTest {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseNextVersionsMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseNextVersionsMojoTest.java
index 533e2cdb..9de1c0c2 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseNextVersionsMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseNextVersionsMojoTest.java
@@ -99,7 +99,7 @@ public class UseNextVersionsMojoTest {
 
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -120,7 +120,7 @@ public class UseNextVersionsMojoTest {
         }));
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
-                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any()))
+                    .when(() -> PomHelper.setDependencyVersion(any(), any(), any(), any(), any(), any(), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -154,7 +154,7 @@ public class UseNextVersionsMojoTest {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -186,7 +186,7 @@ public class UseNextVersionsMojoTest {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
diff --git a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseReleasesMojoTest.java b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseReleasesMojoTest.java
index 0748a87b..fed4f724 100644
--- a/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseReleasesMojoTest.java
+++ b/versions-maven-plugin/src/test/java/org/codehaus/mojo/versions/UseReleasesMojoTest.java
@@ -161,7 +161,7 @@ public class UseReleasesMojoTest extends AbstractMojoTestCase {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))
@@ -190,7 +190,7 @@ public class UseReleasesMojoTest extends AbstractMojoTestCase {
         try (MockedStatic<PomHelper> pomHelper = mockStatic(PomHelper.class)) {
             pomHelper
                     .when(() -> PomHelper.setDependencyVersion(
-                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class)))
+                            any(), anyString(), anyString(), anyString(), anyString(), any(Model.class), any()))
                     .thenReturn(true);
             pomHelper
                     .when(() -> PomHelper.getRawModel(any(MavenProject.class)))