Skip to content

Commit

Permalink
Accept invalid version ranges passed to m-enforcer-p
Browse files Browse the repository at this point in the history
This closes eclipse-m2e#1120
  • Loading branch information
kwin committed Dec 9, 2022
1 parent f9551f4 commit c80b19d
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,11 @@ private static List<Restriction> getVersionRangeRestrictionsIgnoringMicroAndQual
}

private static ArtifactVersion getMajorMinorOnlyVersion(ArtifactVersion lower) {
if(lower.getMajorVersion() == 0) {
// probably invalid range (e.g. "1,2,3", but accepted by maven-enforcer-plugin, just take the original
// to imitate m-e-p behaviour
return lower;
}
return new DefaultArtifactVersion(lower.getMajorVersion() + "." + lower.getMinorVersion());
}

Expand Down

0 comments on commit c80b19d

Please sign in to comment.