From 553aaa9b2ed2ff382d4fa64e85962a588c8ce7f2 Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Fri, 9 Dec 2022 12:27:26 +0100 Subject: [PATCH] Accept versions without major version passed to m-enforcer-p This closes #1120 --- .../m2e/jdt/internal/AbstractJavaProjectConfigurator.java | 4 ++++ 1 file changed, 4 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..168ee65183 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,10 @@ private static List getVersionRangeRestrictionsIgnoringMicroAndQual } private static ArtifactVersion getMajorMinorOnlyVersion(ArtifactVersion lower) { + if(lower.getMajorVersion() == 0) { + // not every version constraint has a major version, in case it doesn't just rely on compareTo semantics as is + return lower; + } return new DefaultArtifactVersion(lower.getMajorVersion() + "." + lower.getMinorVersion()); }