fix(maven): preserve qualified property keys in metadata (#11860)

fix(maven): preserve qualified property keys
This commit is contained in:
ShuaixinHuang authored and GitHub committed 2026-11-18 14:47:42 -05:00
1 parent 82e16b4dda
commit 004c43e32a
4 files changed
+98 -13

No files matched your search

+21
View File
@@ -54,6 +54,27 @@ export const mavenPomFixture = `<?xml version="1.0" encoding="UTF-8"?>
</project>
`;
/** Maven property keys keep their prefixes even when XML namespace URIs agree. */
export const qualifiedMavenPropertiesFixture = `<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:a="urn:revisions" xmlns:b="urn:revisions">
<modelVersion>4.0.0</modelVersion>
<groupId>example</groupId>
<artifactId>qualified-properties</artifactId>
<version>\${a:revision}</version>
<properties>
<revision>0</revision>
<a:revision>11</a:revision>
<b:revision>22</b:revision>
</properties>
<dependencies>
<dependency>
<groupId>example</groupId>
<artifactId>dependency</artifactId>
<version>\${b:revision}</version>
</dependency>
</dependencies>
</project>
`;
/** Tiny Gradle Module Metadata 1.1 document with library and platform variants. */
export const gradleModuleFixture = `{
"formatVersion": "1.1",
+4 -4
View File
@@ -325,15 +325,15 @@ const parsePom = (
const properties =
propertiesElement === undefined
? []
: childElements(propertiesElement).flatMap((property) => {
const name = nonempty(property.localName);
if (name === null) return [];
: childElements(propertiesElement).map((property) => {
// A property may hold a repository URL; its userinfo never leaves the parser.
const {
url: value,
url_credentials_redacted: value_credentials_redacted,
} = redactRecordedTransportUrl(elementText(property));
return [{ name, value, value_credentials_redacted }];
// Maven property keys are the written qualified names, not XML
// expanded names: different prefixes remain different keys.
return { name: property.tagName, value, value_credentials_redacted };
});
const dependencyManagementElement = soleNamed(root, "dependencyManagement");
const managedContainer = dependencyManagementElement