This is an automated email from the ASF dual-hosted git repository. ppalaga pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push: new 4b2a0cc928 camel-quarkus-catalog - Make it possible to get the camel version #4301 4b2a0cc928 is described below commit 4b2a0cc9284b29586fb0176e11f214af4432537b Author: Peter Palaga <ppal...@redhat.com> AuthorDate: Tue Nov 29 11:05:24 2022 +0100 camel-quarkus-catalog - Make it possible to get the camel version #4301 --- .../quarkus/maven/PrepareCatalogQuarkusMojo.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java index 5e2fc00ba8..056c10109f 100644 --- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java +++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java @@ -49,6 +49,8 @@ import org.apache.maven.plugins.annotations.Parameter; public class PrepareCatalogQuarkusMojo extends AbstractExtensionListMojo { public static final String CAMEL_ARTIFACT = "camelArtifact"; + public static final String CAMEL_VERSION = "camelVersion"; + public static final String QUARKUS_VERSION = "quarkusVersion"; /** * The output directory where the catalog files should be written. */ @@ -65,6 +67,14 @@ public class PrepareCatalogQuarkusMojo extends AbstractExtensionListMojo { @Parameter(property = "cq.extendClassPathCatalog", defaultValue = "false") boolean extendClassPathCatalog; + /** + * Quarkus (core) version the current source tree depends on. + * + * @since 2.15.0 + */ + @Parameter(property = "quarkus.version", required = true) + String quarkusVersion; + @Override public void execute() throws MojoExecutionException, MojoFailureException { final Path catalogPath = catalogBaseDir.toPath().resolve(CqCatalog.CQ_CATALOG_DIR); @@ -135,12 +145,12 @@ public class PrepareCatalogQuarkusMojo extends AbstractExtensionListMojo { "description is missing in " + ext.getRuntimePomXmlPath()))); model.setDeprecated(CqUtils.isDeprecated(title, models, ext.isDeprecated())); model.setLabel(ext.getLabel().orElse("quarkus")); - update(model, ext, nativeSupported); + update(model, ext, nativeSupported, quarkusVersion); CqCatalog.serialize(catalogPath, model); schemesByKind.get(model.getKind()).add(model.getName()); } else { for (ArtifactModel<?> model : models) { - update(model, ext, nativeSupported); + update(model, ext, nativeSupported, quarkusVersion); CqCatalog.serialize(catalogPath, model); schemesByKind.get(model.getKind()).add(model.getName()); } @@ -161,12 +171,16 @@ public class PrepareCatalogQuarkusMojo extends AbstractExtensionListMojo { } - private static void update(ArtifactModel<?> model, CamelQuarkusExtension ext, boolean nativeSupported) { + private static void update(ArtifactModel<?> model, CamelQuarkusExtension ext, boolean nativeSupported, + String quarkusVersion) { final String firstVersion = ext.getJvmSince() .orElseThrow(() -> new RuntimeException( "firstVersion property is missing in " + ext.getRuntimePomXmlPath())); + final Map<String, Object> metadata = model.getMetadata(); + metadata.put(QUARKUS_VERSION, quarkusVersion); if (model.getArtifactId() != null && model.getGroupId() != null) { - model.getMetadata().put(CAMEL_ARTIFACT, model.getGroupId() + ":" + model.getArtifactId()); + metadata.put(CAMEL_ARTIFACT, model.getGroupId() + ":" + model.getArtifactId()); + metadata.put(CAMEL_VERSION, model.getVersion()); } // lets use the camel-quarkus version as first version instead of Apache Camel // version