Skip to content

fix: [INFRA-673] Fix Jar properties extraction - #293

Open
alexs-aero wants to merge 4 commits into
mainfrom
fix-673-fix-jar-meta-getter
Open

fix: [INFRA-673] Fix Jar properties extraction#293
alexs-aero wants to merge 4 commits into
mainfrom
fix-673-fix-jar-meta-getter

Conversation

@alexs-aero

@alexs-aero alexs-aero commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Brief

Currently, if a specific JAR parent-child artifact would be posted with empty fields, it could result in empty properties and render workflow corrupted.

This PR extracts Jar property/coordinate handling into separate helper and updates all calls to use extracted properties

Issue

INFRA-673
get_jar_metadata reads a sibling POM when a JAR has no embedded pom.properties. It previously read artifactId, version, and groupId as direct children of <project>, so child-module POMs that inherit coordinates from <parent> returned empty strings and overwrote values already parsed from the filename. Flat-layout child JARs could then structure and upload with blank or wrong GAV metadata.

Changes

  • Extract shared Maven POM parsing into lib/maven-helpers.sh:
    • _maven_read_pom_coordinates — full GAV + packaging/module count, with <parent> fallback
    • _maven_read_pom_gav — GAV-only wrapper for callers that do not need packaging metadata
  • Use pipe-delimited output so empty fields do not shift on read
  • Update get_jar_metadata sibling-POM path to merge only non-empty POM values (filename-derived fields preserved when POM leaves them blank)
  • Reuse the helper in type_detection.sh and entrypoint.sh pom-only upload path (same parent-inheritance bug)
  • Remove duplicate XPath logic from type_detection.sh; simplify _pom_matches_flatten_resolved_heuristic to a single coordinate read
  • Add make_flat_jar_with_pom test helper in maven_fixtures.bash
  • Add docs/maven_lookup.md — resolution matrix, test coverage map, and known Stage 2 limitation for shaded uber JARs (first pom.properties in zip order; not fixed here)

Tests

Added to test_metadata.bats:

  • get_jar_metadata reads name, version and group from a sibling POM — direct GAV on <project>
  • get_jar_metadata keeps filename pkgname when sibling POM inherits all GAV from parent — parent-only POM, no child artifactId
  • get_jar_metadata resolves child module GAV when sibling POM inherits groupId and version from parent — typical multi-module child shape
    Existing maven structuring / bundle-metadata bats tests continue to pass.

@alexs-aero
alexs-aero marked this pull request as ready for review August 11, 2026 20:53
@alexs-aero
alexs-aero requested a review from a team as a code owner August 11, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant