From c80b19d3e5e3ceb95b967d76fec4033f533d57cd Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Fri, 9 Dec 2022 12:27:26 +0100 Subject: [PATCH] Accept invalid version ranges passed to m-enforcer-p This closes #1120 --- .../m2e/jdt/internal/AbstractJavaProjectConfigurator.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java index 09a7654f00..5a991ecbf2 100644 --- a/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java +++ b/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java @@ -907,6 +907,11 @@ private static List 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()); }