From a71bbf6752dab8d37dc29dcaa40fd95fd6a5dc38 Mon Sep 17 00:00:00 2001
From: Sergei Zharinov <zharinov@users.noreply.github.com>
Date: Wed, 25 Nov 2020 16:33:30 +0400
Subject: [PATCH] fix(maven): Treat LATEST and RELEASE as non-version values
 (#7812)

---
 lib/versioning/maven/compare.ts    | 3 +++
 lib/versioning/maven/index.spec.ts | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/lib/versioning/maven/compare.ts b/lib/versioning/maven/compare.ts
index 7b49ffc2ee..775d4b2102 100644
--- a/lib/versioning/maven/compare.ts
+++ b/lib/versioning/maven/compare.ts
@@ -285,6 +285,9 @@ function isVersion(version: string): boolean {
   if (/[.-]$/.test(version)) {
     return false;
   }
+  if (['latest', 'release'].includes(version.toLowerCase())) {
+    return false;
+  }
   const tokens = tokenize(version);
   return !!tokens.length;
 }
diff --git a/lib/versioning/maven/index.spec.ts b/lib/versioning/maven/index.spec.ts
index e10acd6547..a08d7778dc 100644
--- a/lib/versioning/maven/index.spec.ts
+++ b/lib/versioning/maven/index.spec.ts
@@ -307,6 +307,11 @@ describe('versioning/maven/index', () => {
     expect(isVersion('-1')).toBe(false);
     expect(isVersion('1-')).toBe(false);
     expect(isVersion('[1.12.6,1.18.6]')).toBe(false);
+    expect(isVersion('RELEASE')).toBe(false);
+    expect(isVersion('release')).toBe(false);
+    expect(isVersion('LATEST')).toBe(false);
+    expect(isVersion('latest')).toBe(false);
+    expect(isVersion('foobar')).toBe(true);
   });
   it('checks if version is stable', () => {
     expect(isStable('')).toBeNull();
-- 
GitLab