From e8dc549e56a5fbd7d72ee855f7e481ee42e1abe7 Mon Sep 17 00:00:00 2001 From: jonmv Date: Mon, 25 Apr 2022 09:12:36 +0200 Subject: Pass parent version, rather than just whether there was a vespa parent --- .../java/com/yahoo/container/plugin/mojo/ApplicationMojo.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'vespa-application-maven-plugin/src/main/java/com') diff --git a/vespa-application-maven-plugin/src/main/java/com/yahoo/container/plugin/mojo/ApplicationMojo.java b/vespa-application-maven-plugin/src/main/java/com/yahoo/container/plugin/mojo/ApplicationMojo.java index 6fdcf6efe87..b3fd107631b 100644 --- a/vespa-application-maven-plugin/src/main/java/com/yahoo/container/plugin/mojo/ApplicationMojo.java +++ b/vespa-application-maven-plugin/src/main/java/com/yahoo/container/plugin/mojo/ApplicationMojo.java @@ -68,19 +68,18 @@ public class ApplicationMojo extends AbstractMojo { while (current.getParent() != null && current.getParent().getParentArtifact() != null) current = current.getParent(); - boolean hasVespaParent = false; + Version parentVersion = null; Artifact parentArtifact = current.getParentArtifact(); if (parentArtifact != null && (parentArtifact.getGroupId().startsWith("com.yahoo.vespa.") || parentArtifact.getGroupId().startsWith("ai.vespa."))) { - hasVespaParent = true; - Version parentVersion = Version.from(parentArtifact.getVersion()); + parentVersion = Version.from(parentArtifact.getVersion()); if (parentVersion.compareTo(compileVersion) < 0) throw new IllegalArgumentException("compile version (" + compileVersion + ") cannot be higher than parent version (" + parentVersion + ")"); } - String metaData = String.format("{\n \"compileVersion\": \"%s\",\n \"buildTime\": %d,\n \"hasVespaParent\": %b\n}", + String metaData = String.format("{\n \"compileVersion\": \"%s\",\n \"buildTime\": %d,\n \"parentVersion\": %s\n}", compileVersion, System.currentTimeMillis(), - hasVespaParent); + parentVersion); try { Files.write(applicationDestination.toPath().resolve("build-meta.json"), metaData.getBytes(StandardCharsets.UTF_8)); -- cgit v1.2.3