fix: read_pom fallback returned both artifactId and version

When xmllint is not in PATH, the grep fallback in read_pom() captured
both <artifactId> and <version> in a single multi-line string and
returned it for every call. Concatenating it with ':' produced an
invalid Docker tag like:

    test-quarkus\n1.0.0-SNAPSHOT:test-quarkus\n1.0.0-SNAPSHOT

causing 'docker build' to fail with 'invalid reference format'.

Add a third 'tag' argument to read_pom() so the fallback extracts
only the requested element, and pass 'artifactId' / 'version' from
the call sites.

Also enrich pom.xml with <name> and <description> for Maven/IDE
metadata, without changing the image identity.

Tests cover the no-xmllint path explicitly (PATH stripped to
reproduce the vm-compilador environment) and the override path.
This commit is contained in:
2026-09-09 12:10:17 -03:00
parent 6740e4e398
commit 57af30fdd2
2 changed files with 11 additions and 6 deletions
+5
View File
@@ -5,6 +5,11 @@
<groupId>com.example</groupId>
<artifactId>test-quarkus</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Test Quarkus</name>
<description>Sample Quarkus application exposing /status and /q/health endpoints</description>
<properties>
<compiler-plugin.version>3.15.0</compiler-plugin.version>
<maven.compiler.release>17</maven.compiler.release>