Skip to content

Commit

Permalink
Resolves mojohaus#474: Add property support for UseDepVersion
Browse files Browse the repository at this point in the history
- adding a new parameter, processProperties, which will also update property values if dependencies are controlled by properties
  • Loading branch information
andrzejj0 committed Dec 23, 2022
1 parent a244930 commit d803ed7
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@
* under the License.
*/

import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.Optional.ofNullable;
import static org.codehaus.mojo.versions.api.recording.ChangeRecord.ChangeKind.DEPENDENCY;
import static org.codehaus.mojo.versions.api.recording.ChangeRecord.ChangeKind.DEPENDENCY_MANAGEMENT;
import static org.codehaus.mojo.versions.api.recording.ChangeRecord.ChangeKind.PARENT;
import javax.inject.Inject;
import javax.xml.stream.XMLStreamException;

import java.io.File;
import java.io.IOException;
Expand All @@ -40,8 +36,7 @@
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.xml.stream.XMLStreamException;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
Expand All @@ -61,6 +56,13 @@
import org.codehaus.mojo.versions.utils.ModelNode;
import org.codehaus.plexus.util.FileUtils;

import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.Optional.ofNullable;
import static org.codehaus.mojo.versions.api.recording.ChangeRecord.ChangeKind.DEPENDENCY;
import static org.codehaus.mojo.versions.api.recording.ChangeRecord.ChangeKind.DEPENDENCY_MANAGEMENT;
import static org.codehaus.mojo.versions.api.recording.ChangeRecord.ChangeKind.PARENT;

/**
* Updates a dependency to a specific version.
* This can be useful if you have to manage versions for a very large (100+ module) projects where you can’t always use
Expand Down Expand Up @@ -390,10 +392,9 @@ private void useDepVersion(
.filter(p -> p.containsKey(key))
.isPresent());
propertyConflicts.keySet().removeIf(key -> ofNullable(node.getModel().getProfiles())
.map(list -> list.stream()
.anyMatch(p -> ofNullable(p.getProperties())
.filter(prop -> prop.containsKey(key))
.isPresent()))
.map(list -> list.stream().anyMatch(p -> ofNullable(p.getProperties())
.filter(prop -> prop.containsKey(key))
.isPresent()))
.orElse(false));
}

Expand Down

0 comments on commit d803ed7

Please sign in to comment.