From 2cba82f6f4291be02fe3875bad714a7910b1685c Mon Sep 17 00:00:00 2001 From: Sergio Zharinov <zharinov@users.noreply.github.com> Date: Tue, 7 Jan 2020 14:09:09 +0400 Subject: [PATCH] fix(maven): Default group ID for plugins (#5102) Co-authored-by: Michael Kriese <michael.kriese@visualon.de> --- lib/manager/maven/extract.ts | 7 ++++++- test/manager/maven/__snapshots__/extract.spec.ts.snap | 10 ++++++++++ test/manager/maven/__snapshots__/index.spec.ts.snap | 10 ++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/manager/maven/extract.ts b/lib/manager/maven/extract.ts index 89407ca3d7..4484dad38a 100644 --- a/lib/manager/maven/extract.ts +++ b/lib/manager/maven/extract.ts @@ -32,9 +32,14 @@ interface MavenProp { function depFromNode(node: XmlElement): PackageDependency | null { if (!node.valueWithPath) return null; - const groupId = node.valueWithPath('groupId'); + let groupId = node.valueWithPath('groupId'); const artifactId = node.valueWithPath('artifactId'); const currentValue = node.valueWithPath('version'); + + if (!groupId && node.name === 'plugin') { + groupId = 'org.apache.maven.plugins'; + } + if (groupId && artifactId && currentValue) { const depName = `${groupId}:${artifactId}`; const versionNode = node.descendantWithPath('version'); diff --git a/test/manager/maven/__snapshots__/extract.spec.ts.snap b/test/manager/maven/__snapshots__/extract.spec.ts.snap index 601c732451..29929e446d 100644 --- a/test/manager/maven/__snapshots__/extract.spec.ts.snap +++ b/test/manager/maven/__snapshots__/extract.spec.ts.snap @@ -34,6 +34,16 @@ Object { "https://maven.atlassian.com/content/repositories/atlassian-public/", ], }, + Object { + "currentValue": "2.4.2", + "datasource": "maven", + "depName": "org.apache.maven.plugins:maven-release-plugin", + "fileReplacePosition": 1287, + "registryUrls": Array [ + "https://repo.maven.apache.org/maven2", + "https://maven.atlassian.com/content/repositories/atlassian-public/", + ], + }, Object { "currentValue": "1.8.1", "datasource": "maven", diff --git a/test/manager/maven/__snapshots__/index.spec.ts.snap b/test/manager/maven/__snapshots__/index.spec.ts.snap index 0c5c78c660..97decd360a 100644 --- a/test/manager/maven/__snapshots__/index.spec.ts.snap +++ b/test/manager/maven/__snapshots__/index.spec.ts.snap @@ -35,6 +35,16 @@ Array [ "https://maven.atlassian.com/content/repositories/atlassian-public/", ], }, + Object { + "currentValue": "2.4.2", + "datasource": "maven", + "depName": "org.apache.maven.plugins:maven-release-plugin", + "fileReplacePosition": 1287, + "registryUrls": Array [ + "https://repo.maven.apache.org/maven2", + "https://maven.atlassian.com/content/repositories/atlassian-public/", + ], + }, Object { "currentValue": "1.8.1", "datasource": "maven", -- GitLab