Skip to content

Commit

Permalink
Second batch of maintenance following PR #672
Browse files Browse the repository at this point in the history
  • Loading branch information
sultan authored and slawekjaranowski committed Sep 29, 2022
1 parent 63f9bd9 commit 37e8947
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 37e8947

Please sign in to comment.