diff --git a/lib/modules/manager/gradle/parser.spec.ts b/lib/modules/manager/gradle/parser.spec.ts index d234b041ed7504..cfc2e4f3152896 100644 --- a/lib/modules/manager/gradle/parser.spec.ts +++ b/lib/modules/manager/gradle/parser.spec.ts @@ -770,6 +770,17 @@ describe('modules/manager/gradle/parser', () => { const { deps } = parseGradle(input); expect(deps).toMatchObject([output].filter(is.truthy)); }); + + it('handles 3 independent dependencies mismatched as groupId, artifactId, version', () => { + const { deps } = parseGradle( + 'someConfig("foo:bar:1.2.3", "foo:baz:4.5.6", "foo:qux:7.8.9")', + ); + expect(deps).toMatchObject([ + { depName: 'foo:bar', currentValue: '1.2.3' }, + { depName: 'foo:baz', currentValue: '4.5.6' }, + { depName: 'foo:qux', currentValue: '7.8.9' }, + ]); + }); }); describe('calculations', () => { diff --git a/lib/modules/manager/gradle/parser/handlers.ts b/lib/modules/manager/gradle/parser/handlers.ts index 229671b249eaed..4cb6fe719b1118 100644 --- a/lib/modules/manager/gradle/parser/handlers.ts +++ b/lib/modules/manager/gradle/parser/handlers.ts @@ -6,7 +6,7 @@ import { regEx } from '../../../../util/regex'; import type { PackageDependency } from '../../types'; import type { parseGradle as parseGradleCallback } from '../parser'; import type { Ctx, GradleManagerData } from '../types'; -import { parseDependencyString } from '../utils'; +import { isDependencyString, parseDependencyString } from '../utils'; import { GRADLE_PLUGINS, REGISTRY_URLS, @@ -169,6 +169,22 @@ export function handleLongFormDep(ctx: Ctx): Ctx { return ctx; } + // Special handling: 3 independent dependencies mismatched as groupId, artifactId, version + if ( + isDependencyString(groupId) && + isDependencyString(artifactId) && + isDependencyString(version) + ) { + ctx.tokenMap.templateStringTokens = groupIdTokens; + handleDepString(ctx); + ctx.tokenMap.templateStringTokens = artifactIdTokens; + handleDepString(ctx); + ctx.tokenMap.templateStringTokens = versionTokens; + handleDepString(ctx); + + return ctx; + } + const dep = parseDependencyString([groupId, artifactId, version].join(':')); if (!dep) { return ctx;