Skip to content

Commit

Permalink
Second batch of maintenance following PR mojohaus#672
Browse files Browse the repository at this point in the history
  • Loading branch information
sultan committed Sep 28, 2022
1 parent e87bdbd commit d774114
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.codehaus.mojo.versions.api.PomHelper;
import org.codehaus.mojo.versions.api.Segment;
import org.codehaus.mojo.versions.ordering.InvalidSegmentException;
import org.codehaus.mojo.versions.ordering.MajorMinorIncrementalFilter;
import org.codehaus.mojo.versions.rewriting.ModifiedPomXMLEventReader;
import org.codehaus.mojo.versions.utils.DependencyBuilder;

Expand Down Expand Up @@ -166,6 +167,8 @@ private void useLatestVersions( ModifiedPomXMLEventReader pom, Collection<Depend
{
Optional<Segment> unchangedSegment = determineUnchangedSegment( allowMajorUpdates, allowMinorUpdates,
allowIncrementalUpdates );
MajorMinorIncrementalFilter majorMinorIncfilter =
new MajorMinorIncrementalFilter( allowMajorUpdates, allowMinorUpdates, allowIncrementalUpdates );

for ( Dependency dep : dependencies )
{
Expand Down Expand Up @@ -197,9 +200,10 @@ private void useLatestVersions( ModifiedPomXMLEventReader pom, Collection<Depend
try
{
// TODO consider creating a getNewestVersion method in the Details services.
ArtifactVersion[] filteredVersions = versions.getNewerVersions( version, unchangedSegment,
allowSnapshots, allowDowngrade );
ArtifactVersion[] newerVersions = versions.getNewerVersions( version, unchangedSegment, allowSnapshots,
allowDowngrade );

ArtifactVersion[] filteredVersions = majorMinorIncfilter.filter( selectedVersion, newerVersions );
if ( filteredVersions.length > 0 )
{
String newVersion = filteredVersions[filteredVersions.length - 1].toString();
Expand Down

0 comments on commit d774114

Please sign in to comment.