You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/11/15 04:43:49 UTC

[camel-quarkus] branch master updated: Fix #356 Issues in the List of extensions (#425)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/master by this push:
     new 4d4e2c4  Fix #356 Issues in the List of extensions (#425)
4d4e2c4 is described below

commit 4d4e2c442613191890d73f69cec332d907276814
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Fri Nov 15 05:43:43 2019 +0100

    Fix #356 Issues in the List of extensions (#425)
---
 .../quarkus/QuarkusRuntimeProviderTest.java        |   4 +-
 .../pages/list-of-camel-quarkus-extensions.adoc    |  20 +-
 extensions/attachments/runtime/pom.xml             |   4 +
 extensions/core-xml/deployment/pom.xml             |   2 +-
 extensions/core-xml/pom.xml                        |   2 +-
 extensions/core-xml/runtime/pom.xml                |   7 +-
 extensions/fhir/runtime/pom.xml                    |   4 +
 extensions/pdf/runtime/pom.xml                     |   4 +
 extensions/readme.adoc                             |  20 +-
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 605 ++++++++++++---------
 10 files changed, 377 insertions(+), 295 deletions(-)

diff --git a/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java b/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java
index 5867c5b..ea58a68 100644
--- a/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java
+++ b/catalog/camel-quarkus-catalog/src/test/java/org/apache/camel/catalog/quarkus/QuarkusRuntimeProviderTest.java
@@ -112,7 +112,7 @@ public class QuarkusRuntimeProviderTest {
 
         assertTrue(names.contains("core-cloud"));
         assertTrue(names.contains("platform-http"));
-        assertTrue(names.contains("reactive-executor"));
+        assertTrue(names.contains("reactive-executor-vertx"));
 
         assertFalse(names.contains("blueprint"));
         assertFalse(names.contains("hystrix"));
@@ -144,7 +144,7 @@ public class QuarkusRuntimeProviderTest {
 
     @Test
     public void testOtherArtifactId() throws Exception {
-        String json = catalog.otherJSonSchema("reactive-executor");
+        String json = catalog.otherJSonSchema("reactive-executor-vertx");
 
         assertNotNull(json);
         assertTrue(json.contains("camel-quarkus-reactive-executor"));
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index d6a11e2..52b065c 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -43,7 +43,7 @@ Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
 `exec:executable` | 0.4 | The exec component can be used to execute OS system commands.
 
 | xref:extensions/fhir.adoc[FHIR] (camel-quarkus-fhir) +
-`fhir:apiName/methodName` | 0.2 | The fhir component is used for working with the FHIR protocol (health care).
+`fhir:apiName/methodName` | 0.3 | The fhir component is used for working with the FHIR protocol (health care).
 
 | link:https://camel.apache.org/components/latest/file-component.html[File] (camel-quarkus-file) +
 `file:directoryName` | 0.4 | The file component is used for reading or writing files.
@@ -73,7 +73,7 @@ Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
 `paho:topic` | 0.2 | Component for communicating with MQTT message brokers using Eclipse Paho MQTT Client.
 
 | link:https://camel.apache.org/components/latest/pdf-component.html[PDF] (camel-quarkus-pdf) +
-`pdf:operation` | 0.2 | The pdf components provides the ability to create, modify or extract content from PDF documents.
+`pdf:operation` | 0.3.1 | The pdf components provides the ability to create, modify or extract content from PDF documents.
 
 | link:https://camel.apache.org/components/latest/rest-component.html[REST] (camel-quarkus-rest) +
 `rest:method:path:uriTemplate` | 0.2 | The rest component is used for either hosting REST services (consumer) or calling external REST services (producer).
@@ -111,7 +111,7 @@ Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
 | link:https://camel.apache.org/components/latest/vm-component.html[VM] (camel-quarkus-vm) +
 `vm:name` | 0.3 | The vm component provides asynchronous call to another endpoint from the same CamelContext.
 
-| link:https://camel.apache.org/components/latest/xslt-component.html[XSLT] (camel-quarkus-xslt) +
+| xref:extensions/xslt.adoc[XSLT] (camel-quarkus-xslt) +
 `xslt:resourceUri` | 0.4 | Transforms the message using a XSLT template.
 
 |===
@@ -128,9 +128,9 @@ Number of Camel data formats: 8 in 7 JAR artifacts (0 deprecated)
 
 | link:https://camel.apache.org/components/latest/csv-dataformat.html[CSV] (camel-quarkus-csv) | 0.2 | The CSV data format is used for handling CSV payloads.
 
-| xref:extensions/fhir.adoc[FHIR JSon] (camel-quarkus-fhir) | 0.2 | The FHIR JSon data format is used to marshall/unmarshall to/from FHIR objects to/from JSON.
+| xref:extensions/fhir.adoc[FHIR JSon] (camel-quarkus-fhir) | 0.3 | The FHIR JSon data format is used to marshall/unmarshall to/from FHIR objects to/from JSON.
 
-| xref:extensions/fhir.adoc[FHIR XML] (camel-quarkus-fhir) | 0.2 | The FHIR XML data format is used to marshall/unmarshall from/to FHIR objects to/from XML.
+| xref:extensions/fhir.adoc[FHIR XML] (camel-quarkus-fhir) | 0.3 | The FHIR XML data format is used to marshall/unmarshall from/to FHIR objects to/from XML.
 
 | link:https://camel.apache.org/components/latest/json-jackson-dataformat.html[JSon Jackson] (camel-quarkus-jackson) | 0.3 | JSon data format is used for unmarshal a JSon payload to POJO or to marshal POJO back to JSon payload.
 
@@ -180,18 +180,18 @@ Number of miscellaneous extensions: 7 in 7 JAR artifacts (0 deprecated)
 |===
 | Extension | Since | Description
 
-| (camel-quarkus-attachments) | 0.2 | Maven plugins configuration
+| (camel-quarkus-attachments) | 0.3 | Java Attachments support for Camel Message
 
 | (camel-quarkus-core-cloud) | 0.2 | The Camel Quarkus core cloud module
 
 | xref:extensions/platform-http.adoc[camel-quarkus-platform-http]  | 0.3 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
 
-| (camel-quarkus-reactive-executor) | 0.3 | To use Quarkus reactive executor with Camel
+| (camel-quarkus-core-xml) | 0.3 | Includes implementations of Java Architecture for XML Binding (JAXB) and Java API for XML Processing (JAXP)
 
-| (camel-quarkus-core-xml) | 0.2 | Maven plugins configuration
-
-| xref:extensions/microprofile-health.adoc[camel-quarkus-microprofile-health]  | 0.3 | Integration with the Quarkus MicroProfile Health extension
+| xref:extensions/microprofile-health.adoc[camel-quarkus-microprofile-health]  | 0.3 | Bridging Eclipse MicroProfile Health with Camel health checks
 
 | xref:extensions/opentracing.adoc[camel-quarkus-opentracing]  | 0.3 | Distributed tracing using OpenTracing
+
+| (camel-quarkus-reactive-executor) | 0.3 | Reactive Executor for camel-core using Vert.x
 |===
 // others: END
diff --git a/extensions/attachments/runtime/pom.xml b/extensions/attachments/runtime/pom.xml
index 0cce225..609cc42 100644
--- a/extensions/attachments/runtime/pom.xml
+++ b/extensions/attachments/runtime/pom.xml
@@ -29,6 +29,10 @@
     <artifactId>camel-quarkus-attachments</artifactId>
     <name>Camel Quarkus :: Attachments :: Runtime</name>
 
+    <properties>
+        <firstVersion>0.3.0</firstVersion>
+    </properties>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
diff --git a/extensions/core-xml/deployment/pom.xml b/extensions/core-xml/deployment/pom.xml
index 1b1de12..c1dc21c 100644
--- a/extensions/core-xml/deployment/pom.xml
+++ b/extensions/core-xml/deployment/pom.xml
@@ -27,7 +27,7 @@
     </parent>
 
     <artifactId>camel-quarkus-core-xml-deployment</artifactId>
-    <name>Camel Quarkus :: Core :: XML :: Deployment</name>
+    <name>Camel Quarkus :: Core XML :: Deployment</name>
 
     <dependencyManagement>
         <dependencies>
diff --git a/extensions/core-xml/pom.xml b/extensions/core-xml/pom.xml
index cb3d112..8231b09 100644
--- a/extensions/core-xml/pom.xml
+++ b/extensions/core-xml/pom.xml
@@ -27,7 +27,7 @@
     </parent>
 
     <artifactId>camel-quarkus-core-xml-parent</artifactId>
-    <name>Camel Quarkus :: Core :: XML</name>
+    <name>Camel Quarkus :: Core XML</name>
     <packaging>pom</packaging>
 
     <modules>
diff --git a/extensions/core-xml/runtime/pom.xml b/extensions/core-xml/runtime/pom.xml
index 2c9d0b3..1c0d940 100644
--- a/extensions/core-xml/runtime/pom.xml
+++ b/extensions/core-xml/runtime/pom.xml
@@ -27,7 +27,12 @@
     </parent>
 
     <artifactId>camel-quarkus-core-xml</artifactId>
-    <name>Camel Quarkus :: Core :: XML :: Runtime</name>
+    <name>Camel Quarkus :: Core XML :: Runtime</name>
+    <description>Includes implementations of Java Architecture for XML Binding (JAXB) and Java API for XML Processing (JAXP)</description>
+
+    <properties>
+        <firstVersion>0.3.0</firstVersion>
+    </properties>
 
     <dependencyManagement>
         <dependencies>
diff --git a/extensions/fhir/runtime/pom.xml b/extensions/fhir/runtime/pom.xml
index d2f42cc..c63b0df 100644
--- a/extensions/fhir/runtime/pom.xml
+++ b/extensions/fhir/runtime/pom.xml
@@ -29,6 +29,10 @@
     <artifactId>camel-quarkus-fhir</artifactId>
     <name>Camel Quarkus :: FHIR :: Runtime</name>
 
+    <properties>
+        <firstVersion>0.3.0</firstVersion>
+    </properties>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
diff --git a/extensions/pdf/runtime/pom.xml b/extensions/pdf/runtime/pom.xml
index c961dd5..7f50c73 100644
--- a/extensions/pdf/runtime/pom.xml
+++ b/extensions/pdf/runtime/pom.xml
@@ -29,6 +29,10 @@
     <artifactId>camel-quarkus-pdf</artifactId>
     <name>Camel Quarkus :: PDF :: Runtime</name>
 
+    <properties>
+        <firstVersion>0.3.1</firstVersion>
+    </properties>
+
     <dependencyManagement>
         <dependencies>
             <dependency>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index ece78a0..4b87922 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -42,7 +42,7 @@ Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
 `exec:executable` | 0.4 | The exec component can be used to execute OS system commands.
 
 | xref:extensions/fhir.adoc[FHIR] (camel-quarkus-fhir) +
-`fhir:apiName/methodName` | 0.2 | The fhir component is used for working with the FHIR protocol (health care).
+`fhir:apiName/methodName` | 0.3 | The fhir component is used for working with the FHIR protocol (health care).
 
 | link:https://camel.apache.org/components/latest/file-component.html[File] (camel-quarkus-file) +
 `file:directoryName` | 0.4 | The file component is used for reading or writing files.
@@ -72,7 +72,7 @@ Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
 `paho:topic` | 0.2 | Component for communicating with MQTT message brokers using Eclipse Paho MQTT Client.
 
 | link:https://camel.apache.org/components/latest/pdf-component.html[PDF] (camel-quarkus-pdf) +
-`pdf:operation` | 0.2 | The pdf components provides the ability to create, modify or extract content from PDF documents.
+`pdf:operation` | 0.3.1 | The pdf components provides the ability to create, modify or extract content from PDF documents.
 
 | link:https://camel.apache.org/components/latest/rest-component.html[REST] (camel-quarkus-rest) +
 `rest:method:path:uriTemplate` | 0.2 | The rest component is used for either hosting REST services (consumer) or calling external REST services (producer).
@@ -110,7 +110,7 @@ Number of Camel components: 34 in 30 JAR artifacts (0 deprecated)
 | link:https://camel.apache.org/components/latest/vm-component.html[VM] (camel-quarkus-vm) +
 `vm:name` | 0.3 | The vm component provides asynchronous call to another endpoint from the same CamelContext.
 
-| link:https://camel.apache.org/components/latest/xslt-component.html[XSLT] (camel-quarkus-xslt) +
+| xref:extensions/xslt.adoc[XSLT] (camel-quarkus-xslt) +
 `xslt:resourceUri` | 0.4 | Transforms the message using a XSLT template.
 
 |===
@@ -128,9 +128,9 @@ Number of Camel data formats: 8 in 7 JAR artifacts (0 deprecated)
 
 | link:https://camel.apache.org/components/latest/csv-dataformat.html[CSV] (camel-quarkus-csv) | 0.2 | The CSV data format is used for handling CSV payloads.
 
-| xref:extensions/fhir.adoc[FHIR JSon] (camel-quarkus-fhir) | 0.2 | The FHIR JSon data format is used to marshall/unmarshall to/from FHIR objects to/from JSON.
+| xref:extensions/fhir.adoc[FHIR JSon] (camel-quarkus-fhir) | 0.3 | The FHIR JSon data format is used to marshall/unmarshall to/from FHIR objects to/from JSON.
 
-| xref:extensions/fhir.adoc[FHIR XML] (camel-quarkus-fhir) | 0.2 | The FHIR XML data format is used to marshall/unmarshall from/to FHIR objects to/from XML.
+| xref:extensions/fhir.adoc[FHIR XML] (camel-quarkus-fhir) | 0.3 | The FHIR XML data format is used to marshall/unmarshall from/to FHIR objects to/from XML.
 
 | link:https://camel.apache.org/components/latest/json-jackson-dataformat.html[JSon Jackson] (camel-quarkus-jackson) | 0.3 | JSon data format is used for unmarshal a JSon payload to POJO or to marshal POJO back to JSon payload.
 
@@ -182,19 +182,19 @@ Number of miscellaneous extensions: 7 in 7 JAR artifacts (0 deprecated)
 |===
 | Extension | Since | Description
 
-| (camel-quarkus-attachments) | 0.2 | Maven plugins configuration
+| (camel-quarkus-attachments) | 0.3 | Java Attachments support for Camel Message
 
 | (camel-quarkus-core-cloud) | 0.2 | The Camel Quarkus core cloud module
 
 | xref:extensions/platform-http.adoc[camel-quarkus-platform-http]  | 0.3 | HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer
 
-| (camel-quarkus-reactive-executor) | 0.3 | To use Quarkus reactive executor with Camel
+| (camel-quarkus-core-xml) | 0.3 | Includes implementations of Java Architecture for XML Binding (JAXB) and Java API for XML Processing (JAXP)
 
-| (camel-quarkus-core-xml) | 0.2 | Maven plugins configuration
-
-| xref:extensions/microprofile-health.adoc[camel-quarkus-microprofile-health]  | 0.3 | Integration with the Quarkus MicroProfile Health extension
+| xref:extensions/microprofile-health.adoc[camel-quarkus-microprofile-health]  | 0.3 | Bridging Eclipse MicroProfile Health with Camel health checks
 
 | xref:extensions/opentracing.adoc[camel-quarkus-opentracing]  | 0.3 | Distributed tracing using OpenTracing
+
+| (camel-quarkus-reactive-executor) | 0.3 | Reactive Executor for camel-core using Vert.x
 |===
 // others: END
 
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 86951e3..9dbdaea 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -16,25 +16,35 @@
  */
 package org.apache.camel.quarkus.maven;
 
+import java.io.BufferedReader;
 import java.io.File;
-import java.io.FileInputStream;
 import java.io.IOException;
-import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.Writer;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.EnumMap;
 import java.util.HashMap;
-import java.util.LinkedHashSet;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Optional;
+import java.util.Properties;
 import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.TreeSet;
+import java.util.stream.Collectors;
 
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Dependency;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -45,14 +55,16 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
 import org.apache.maven.project.ProjectBuilder;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.ProjectBuildingResult;
 import org.apache.maven.repository.RepositorySystem;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 import org.mvel2.templates.TemplateRuntime;
 
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParser;
+
 import static org.apache.camel.maven.packaging.PackageHelper.loadText;
-import static org.apache.camel.maven.packaging.PackageHelper.writeText;
-import static org.apache.camel.maven.packaging.StringHelper.camelDashToTitle;
 
 /**
  * Prepares the Quarkus provider camel catalog to include component it supports
@@ -60,18 +72,7 @@ import static org.apache.camel.maven.packaging.StringHelper.camelDashToTitle;
 @Mojo(name = "prepare-catalog-quarkus", threadSafe = true, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
 public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
-    private static final String DEFAULT_FIRST_VERSION = "0.2.0";
-
-    private static final String[] EXCLUDE_EXTENSIONS = {
-            "http-common", "support"
-    };
-
-    private static final Pattern SCHEME_PATTERN = Pattern.compile("\"scheme\": \"(.*)\"");
-    private static final Pattern NAME_PATTERN = Pattern.compile("\"name\": \"(.*)\"");
-    private static final Pattern GROUP_PATTERN = Pattern.compile("\"groupId\": \"(org.apache.camel)\"");
-    private static final Pattern ARTIFACT_PATTERN = Pattern.compile("\"artifactId\": \"camel-(.*)\"");
-    private static final Pattern VERSION_PATTERN = Pattern.compile("\"version\": \"(.*)\"");
-    private static final Pattern FIRST_VERSION_PATTERN = Pattern.compile("\"firstVersion\": \"(.*)\"");
+    private static final Set<String> EXCLUDE_EXTENSIONS = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("http-common", "support")));
 
     /**
      * The maven project.
@@ -130,315 +131,379 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
      */
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
-        Set<String> extensions = findExtensions();
-        Set<String> artifacts = extractArtifactIds(extensions);
-        executeComponents(artifacts);
-        executeLanguages(artifacts);
-        executeDataFormats(artifacts);
-        executeOthers(extensions);
-    }
-
-    private Set<String> extractArtifactIds(Set<String> extensions) throws MojoFailureException {
-        Set<String> answer = new LinkedHashSet<>();
-        for (String extension : extensions) {
-            try {
-                MavenProject extProject = getMavenProject("org.apache.camel.quarkus", "camel-quarkus-" + extension,
-                        project.getVersion());
-                // grab camel artifact
-                Optional<Dependency> artifact = extProject.getDependencies().stream()
-                        .filter(p -> "org.apache.camel".equals(p.getGroupId()) && "compile".equals(p.getScope()))
-                        .findFirst();
-                if (artifact.isPresent()) {
-                    String artifactId = artifact.get().getArtifactId();
-                    answer.add(artifactId);
-                }
-            } catch (ProjectBuildingException e) {
-                throw new MojoFailureException("Cannot read pom.xml for extension " + extension, e);
-            }
+        final List<CamelQuarkusExtension> extensions = findExtensionModules();
+        final CamelCatalog camelCatalog = CamelCatalog.load();
+        for (Kind kind : Kind.values()) {
+            doExecute(extensions, kind, camelCatalog);
         }
-        return answer;
+        appendOthers(extensions, camelCatalog);
     }
 
-    protected void executeComponents(Set<String> artifactIds) throws MojoExecutionException, MojoFailureException {
-        doExecute(artifactIds, "components", componentsOutDir);
-    }
-
-    protected void executeLanguages(Set<String> artifactIds) throws MojoExecutionException, MojoFailureException {
-        // include core languages (simple, header etc) and refer to camel-quarkus-core
-        Set<String> set = new LinkedHashSet<>();
-        set.add("camel-base");
-        set.addAll(artifactIds);
+    protected void doExecute(List<CamelQuarkusExtension> extensions, Kind kind, CamelCatalog catalog) throws MojoExecutionException {
 
-        doExecute(set, "languages", languagesOutDir);
-    }
+        final Path outsDir = kind.getPath(this);
 
-    protected void executeDataFormats(Set<String> artifactIds) throws MojoExecutionException, MojoFailureException {
-        doExecute(artifactIds, "dataformats", dataFormatsOutDir);
-    }
-
-    protected void doExecute(Set<String> artifactIds, String kind, File outsDir)
-            throws MojoExecutionException, MojoFailureException {
-        // grab from camel-catalog
-        List<String> catalog;
+        // make sure to create out dir
         try {
-            InputStream is = getClass().getClassLoader()
-                    .getResourceAsStream("org/apache/camel/catalog/" + kind + ".properties");
-            String text = loadText(is);
-            catalog = Arrays.asList(text.split("\n"));
-            getLog().debug("Loaded " + catalog.size() + " " + kind + " from camel-catalog");
+            Files.createDirectories(outsDir);
         } catch (IOException e) {
-            throw new MojoFailureException("Error loading resource from camel-catalog due " + e.getMessage(), e);
+            throw new MojoExecutionException("Could not create " + outsDir, e);
         }
 
-        // make sure to create out dir
-        outsDir.mkdirs();
-
-        for (String artifactId : artifactIds) {
-            // for quarkus we need to amend the json file to use the quarkus maven GAV
-            List<String> jsonFiles = new ArrayList<>();
-            try {
-                for (String name : catalog) {
-                    InputStream is = getClass().getClassLoader()
-                            .getResourceAsStream("org/apache/camel/catalog/" + kind + "/" + name + ".json");
-                    String text = loadText(is);
-                    boolean match = text.contains("\"artifactId\": \"" + artifactId + "\"");
-                    if (match) {
-                        try {
-                            String qaid;
-                            if ("camel-base".equals(artifactId)) {
-                                qaid = "camel-quarkus-core";
-                            } else {
-                                qaid = artifactId.replaceFirst("camel-", "camel-quarkus-");
-                            }
-                            MavenProject extPom = getMavenProject("org.apache.camel.quarkus", qaid, project.getVersion());
-                            String firstVersion = (String) extPom.getProperties().getOrDefault("firstVersion",
-                                    DEFAULT_FIRST_VERSION);
-                            // lets use the camel-quarkus version as first version instead of Apache Camel version
-                            text = FIRST_VERSION_PATTERN.matcher(text)
-                                    .replaceFirst("\"firstVersion\": \"" + firstVersion + "\"");
-
-                            // update json metadata to adapt to camel-quarkus-catalog
-                            text = GROUP_PATTERN.matcher(text).replaceFirst("\"groupId\": \"org.apache.camel.quarkus\"");
-                            if ("camel-base".equals(artifactId)) {
-                                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-core\"");
-                            } else {
-                                text = ARTIFACT_PATTERN.matcher(text).replaceFirst("\"artifactId\": \"camel-quarkus-$1\"");
-                            }
-                            text = VERSION_PATTERN.matcher(text).replaceFirst("\"version\": \"" + project.getVersion() + "\"");
-                        } catch (ProjectBuildingException e) {
-                            throw new MojoFailureException("Error loading pom.xml from extension " + name, e);
-                        }
-
-                        jsonFiles.add(text);
-                    }
-                }
-            } catch (IOException e) {
-                throw new MojoFailureException("Cannot read camel-catalog", e);
-            }
-
-            for (String text : jsonFiles) {
-                // compute the name depending on what kind it is
-                Pattern pattern;
-                if ("components".equals(kind)) {
-                    pattern = SCHEME_PATTERN;
-                } else if ("languages".equals(kind)) {
-                    pattern = NAME_PATTERN;
-                } else if ("dataformats".equals(kind)) {
-                    pattern = NAME_PATTERN;
-                } else {
-                    throw new IllegalArgumentException("Unknown kind " + kind);
-                }
-
-                Matcher matcher = pattern.matcher(text);
-                if (matcher.find()) {
-                    String name = matcher.group(1);
-                    try {
-                        File to = new File(outsDir, name + ".json");
-                        writeText(to, text);
-                    } catch (IOException e) {
-                        throw new MojoFailureException("Cannot write json file " + name, e);
-                    }
+        final Gson gson = new GsonBuilder().enableComplexMapKeySerialization().setPrettyPrinting().create();
+
+        final Set<String> names = new TreeSet<>();
+
+        for (CamelQuarkusExtension ext : extensions) {
+            final String artifactId = ext.getCamelComponentArtifactId();
+            for (JsonObject catalogEntry : catalog.getByArtifactId(kind, artifactId)) {
+                final JsonObject newCatalogEntry = catalogEntry.deepCopy();
+                final JsonObject kindObject = newCatalogEntry.get(kind.getSingularName()).getAsJsonObject();
+                final String firstVersion = ext.getFirstVersion().orElseThrow(() -> new MojoExecutionException(
+                        "firstVersion property is missing in " + ext.getRuntimePomXmlPath()));
+                // lets use the camel-quarkus version as first version instead of Apache Camel version
+                kindObject.addProperty("firstVersion", firstVersion);
+
+                // update json metadata to adapt to camel-quarkus-catalog
+                kindObject.addProperty("groupId", "org.apache.camel.quarkus");
+                kindObject.addProperty("artifactId", ext.getRuntimeArtifactId());
+                kindObject.addProperty("version", project.getVersion());
+
+                final String name = kind.getName(newCatalogEntry);
+                names.add(name);
+                final Path out = outsDir.resolve(name + ".json");
+                try (Writer w = Files.newBufferedWriter(out, StandardCharsets.UTF_8)) {
+                    gson.toJson(newCatalogEntry, w);
+                } catch (IOException e) {
+                    throw new MojoExecutionException("Could not write to " + out);
                 }
             }
         }
 
-        File all = new File(outsDir, "../" + kind + ".properties");
+        final Path newCatalog = outsDir.resolve("../" + kind + ".properties");
         try {
-            String[] names = outsDir.list();
-            List<String> lines = new ArrayList<>();
-            for (String name : names) {
-                if (name.endsWith(".json")) {
-                    // strip out .json from the name
-                    String shortName = name.substring(0, name.length() - 5);
-                    lines.add(shortName);
-                }
-            }
-            // sort lines
-            Collections.sort(lines);
-            // write properties file
-            String text = String.join("\n", lines);
-            writeText(all, text);
-
-            getLog().info("Added " + lines.size() + " " + kind + " to quarkus-camel-catalog");
-
+            Files.write(newCatalog, names.stream().collect(Collectors.joining("\n")).getBytes(StandardCharsets.UTF_8));
         } catch (IOException e) {
-            throw new MojoFailureException("Error writing to file " + all);
+            throw new MojoExecutionException("Could not write to " + newCatalog);
         }
     }
 
-    protected void executeOthers(Set<String> extensions) throws MojoExecutionException, MojoFailureException {
+    protected void appendOthers(List<CamelQuarkusExtension> extensions, CamelCatalog catalog) throws MojoExecutionException, MojoFailureException {
         // make sure to create out dir
         othersOutDir.mkdirs();
+        final Path othersPropertiesPath = othersOutDir.toPath().resolve("../others.properties");
 
-        for (String extension : extensions) {
-            // skip if the extension is already one of the following
-            try {
-                boolean component = isComponent(extension);
-                boolean language = isLanguage(extension);
-                boolean dataFormat = isDataFormat(extension);
-                if (component || language || dataFormat) {
-                    continue;
-                }
-            } catch (IOException e) {
-                throw new MojoFailureException("Error reading generated files for extension " + extension, e);
-            }
-
-            try {
-                MavenProject extPom = getMavenProject("org.apache.camel.quarkus", "camel-quarkus-" + extension,
-                        project.getVersion());
+        Set<String> names;
+        try {
+            names = Files.lines(othersPropertiesPath).collect(Collectors.toCollection(TreeSet::new));
+        } catch (IOException e) {
+            throw new RuntimeException("Could not read " + othersPropertiesPath, e);
+        }
 
-                Map<String, Object> model = new HashMap<>();
-                model.put("name", extension);
-                String title = extPom.getProperties().getProperty("title");
-                if (title == null) {
-                    title = camelDashToTitle(extension);
-                }
+        for (CamelQuarkusExtension ext : extensions) {
+            // skip if the extension is already one of the following
+            if (ext.getCamelComponentArtifactId() == null || !catalog.getKind(ext.getCamelComponentArtifactId()).isPresent()) {
+                final Map<String, String> model = new HashMap<>();
+
+                String firstVersion = ext.getFirstVersion().orElseThrow(() -> new MojoExecutionException(
+                        "firstVersion property is missing in " + ext.getRuntimePomXmlPath()));
+                model.put("firstVersion", firstVersion);
+
+                final String name = ext.getRuntimeArtifactId().replace("camel-quarkus-", "");
+                names.add(name);
+                model.put("name", name);
+                final String title = ext.getName().orElseThrow(() -> new MojoExecutionException(
+                        "name is missing in " + ext.getRuntimePomXmlPath()));
                 model.put("title", title);
-                model.put("description", extPom.getDescription());
-                if (extPom.getName() != null && extPom.getName().contains("(deprecated)")) {
+                model.put("description", ext.getDescription().orElseThrow(() -> new MojoExecutionException(
+                        "description is missing in " + ext.getRuntimePomXmlPath())));
+                if (title.contains("(deprecated)")) {
                     model.put("deprecated", "true");
                 } else {
                     model.put("deprecated", "false");
                 }
-                model.put("firstVersion", extPom.getProperties().getOrDefault("firstVersion", "0.2.0"));
-                model.put("label", extPom.getProperties().getOrDefault("label", "quarkus"));
+                model.put("label", ext.getLabel().orElse("quarkus"));
                 model.put("groupId", "org.apache.camel.quarkus");
-                model.put("artifactId", "camel-quarkus-" + extension);
+                model.put("artifactId", ext.getRuntimeArtifactId());
                 model.put("version", project.getVersion());
 
-                String text = templateOther(model);
+                final String text = templateOther(model);
 
                 // write new json file
-                File to = new File(othersOutDir, extension + ".json");
-                writeText(to, text);
-
-            } catch (IOException e) {
-                throw new MojoFailureException("Cannot write json file " + extension, e);
-            } catch (ProjectBuildingException e) {
-                throw new MojoFailureException("Error loading pom.xml from extension " + extension, e);
+                Path to = othersOutDir.toPath().resolve(name + ".json");
+                try {
+                    Files.write(to, text.getBytes(StandardCharsets.UTF_8));
+                } catch (IOException e) {
+                    throw new RuntimeException("Could not write to " + to, e);
+                }
             }
         }
-
-        File all = new File(othersOutDir, "../others.properties");
         try {
-            String[] names = othersOutDir.list();
-            List<String> others = new ArrayList<>();
-            // sort the names
-            for (String name : names) {
-                if (name.endsWith(".json")) {
-                    // strip out .json from the name
-                    String otherName = name.substring(0, name.length() - 5);
-                    others.add(otherName);
-                }
-            }
-
-            Collections.sort(others);
-            // write properties file
-            String text = String.join("\n", others);
-            writeText(all, text);
+            Files.write(othersPropertiesPath, names.stream().collect(Collectors.joining("\n")).getBytes(StandardCharsets.UTF_8));
+        } catch (IOException e) {
+            throw new RuntimeException("Could not write to " + othersPropertiesPath, e);
+        }
+    }
 
-            getLog().info("Added " + others.size() + " others to quarkus-camel-catalog");
+    private String templateOther(Map<?, ?> model) throws MojoExecutionException {
+        try {
+            String template = loadText(getClass().getClassLoader().getResourceAsStream("other-template.mvel"));
+            String out = (String) TemplateRuntime.eval(template, model);
+            return out;
+        } catch (Exception e) {
+            throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e);
+        }
+    }
 
+    private List<CamelQuarkusExtension> findExtensionModules() {
+        try {
+            return Files.list(extensionsDir.toPath())
+                    .filter(Files::isDirectory)
+                    .filter(path -> !EXCLUDE_EXTENSIONS.contains(path.getFileName().toString()))
+                    .map(path -> path.resolve("pom.xml"))
+                    .filter(Files::exists)
+                    .map(CamelQuarkusExtension::read)
+                    .collect(Collectors.toList());
         } catch (IOException e) {
-            throw new MojoFailureException("Error writing to file " + all);
+            throw new RuntimeException("Could not list " + extensionsDir, e);
         }
     }
 
-    private boolean isComponent(String extension) throws IOException {
-        for (File file : componentsOutDir.listFiles()) {
-            FileInputStream fis = new FileInputStream(file);
-            String text = loadText(fis);
-            fis.close();
-            if (text.contains("camel-quarkus-" + extension)) {
-                return true;
+    enum Kind {
+        components() {
+            @Override
+            public String getName(JsonObject json) {
+                return json.get(getSingularName()).getAsJsonObject().get("scheme").getAsString();
+            }
+
+            @Override
+            public Path getPath(PrepareCatalogQuarkusMojo mojo) {
+                return mojo.componentsOutDir.toPath();
+            }
+
+        },
+        languages() {
+            @Override
+            public String getName(JsonObject json) {
+                return json.get(getSingularName()).getAsJsonObject().get("name").getAsString();
+            }
+
+            @Override
+            public Path getPath(PrepareCatalogQuarkusMojo mojo) {
+                return mojo.languagesOutDir.toPath();
+            }
+        },
+        dataformats() {
+            @Override
+            public String getName(JsonObject json) {
+                return json.get(getSingularName()).getAsJsonObject().get("name").getAsString();
+            }
+
+            @Override
+            public Path getPath(PrepareCatalogQuarkusMojo mojo) {
+                return mojo.dataFormatsOutDir.toPath();
+            }
+        },
+        others() {
+            @Override
+            public String getName(JsonObject json) {
+                return json.get(getSingularName()).getAsJsonObject().get("name").getAsString();
             }
-        }
-        return false;
-    }
 
-    private boolean isLanguage(String extension) throws IOException {
-        for (File file : languagesOutDir.listFiles()) {
-            FileInputStream fis = new FileInputStream(file);
-            String text = loadText(fis);
-            fis.close();
-            if (text.contains("camel-quarkus-" + extension)) {
-                return true;
+            @Override
+            public Path getPath(PrepareCatalogQuarkusMojo mojo) {
+                return mojo.othersOutDir.toPath();
             }
         }
-        return false;
+        ;
+
+        public abstract String getName(JsonObject json);
+        public abstract Path getPath(PrepareCatalogQuarkusMojo mojo);
+        public String getSingularName() {
+            return name().substring(0, name().length() - 1);
+        }
     }
 
-    private boolean isDataFormat(String extension) throws IOException {
-        for (File file : dataFormatsOutDir.listFiles()) {
-            FileInputStream fis = new FileInputStream(file);
-            String text = loadText(fis);
-            fis.close();
-            if (text.contains("camel-quarkus-" + extension)) {
-                return true;
+    static class CamelCatalog {
+
+        public static CamelCatalog load() {
+
+            Map<Kind, Map<String, List<JsonObject>>> entriesByKindByArtifactId = new EnumMap<>(Kind.class);
+
+            for (Kind kind : Kind.values()) {
+                final String resourcePath = "org/apache/camel/catalog/" + kind + ".properties";
+                final URL url = PrepareCatalogQuarkusMojo.class.getClassLoader().getResource(resourcePath);
+                try (BufferedReader propsReader = new BufferedReader(
+                        new InputStreamReader(
+                                url.openStream(),
+                                StandardCharsets.UTF_8))) {
+                    /* Load the catalog entries */
+
+                    final JsonParser jsonParser = new JsonParser();
+                    final Map<String, List<JsonObject>> entries = new HashMap<>();
+                    propsReader.lines()
+                        .map(name -> {
+                            final String rPath = "org/apache/camel/catalog/" + kind + "/" + name + ".json";
+                            try (Reader r = new InputStreamReader(PrepareCatalogQuarkusMojo.class.getClassLoader()
+                                    .getResourceAsStream(rPath ), StandardCharsets.UTF_8)) {
+                                return jsonParser.parse(r).getAsJsonObject();
+                            } catch (IOException e) {
+                                throw new RuntimeException("Could not load resource " + rPath + " from class path", e);
+                            }
+                       })
+                       .forEach(json -> {
+                           String aid = json.get(kind.getSingularName()).getAsJsonObject().get("artifactId").getAsString();
+                           List<JsonObject> jsons = entries.get(aid);
+                           if (jsons == null) {
+                               jsons = new ArrayList<JsonObject>();
+                               entries.put(aid, jsons);
+                           }
+                           jsons.add(json);
+                       });
+
+                    entriesByKindByArtifactId.put(kind, entries);
+
+                } catch (IOException e) {
+                    throw new RuntimeException("Could not load resource " + resourcePath + " from class path", e);
+                }
             }
+            return new CamelCatalog(entriesByKindByArtifactId);
+
         }
-        return false;
-    }
 
-    private MavenProject getMavenProject(String groupId, String artifactId, String version) throws ProjectBuildingException {
-        Artifact pomArtifact = repositorySystem.createProjectArtifact(groupId, artifactId, version);
-        ProjectBuildingResult build = mavenProjectBuilder.build(pomArtifact, session.getProjectBuildingRequest());
-        return build.getProject();
-    }
+        private final Map<Kind, Map<String, List<JsonObject>>> entriesByKindByArtifactId;
 
-    private String templateOther(Map model) throws MojoExecutionException {
-        try {
-            String template = loadText(getClass().getClassLoader().getResourceAsStream("other-template.mvel"));
-            String out = (String) TemplateRuntime.eval(template, model);
-            return out;
-        } catch (Exception e) {
-            throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e);
+        public CamelCatalog(Map<Kind, Map<String, List<JsonObject>>> entriesByKindByArtifactId2) {
+            super();
+            this.entriesByKindByArtifactId = entriesByKindByArtifactId2;
+        }
+
+        public List<JsonObject> getByArtifactId(Kind kind, String artifactId) {
+            final Map<String, List<JsonObject>> kindEntries = entriesByKindByArtifactId.get(kind);
+            List<JsonObject> result = kindEntries != null ? kindEntries.get(artifactId) : null;
+            return result == null ? Collections.emptyList() : result;
+        }
+
+        public Optional<Kind> getKind(String artifactId) {
+            return entriesByKindByArtifactId.entrySet().stream()
+                    .filter(en -> en.getValue().containsKey(artifactId))
+                    .map(Entry::getKey)
+                    .findFirst();
         }
     }
 
-    private Set<String> findExtensions() {
-        Set<String> answer = new LinkedHashSet<>();
-
-        File[] names = extensionsDir.listFiles();
-        if (names != null) {
-            for (File name : names) {
-                if (name.isDirectory()) {
-                    boolean excluded = isExcludedExtension(name.getName());
-                    boolean active = new File(name, "pom.xml").exists();
-                    if (!excluded && active) {
-                        answer.add(name.getName());
+    static class CamelQuarkusExtension {
+
+        public static CamelQuarkusExtension read(Path parentPomXmlPath) {
+            final Path runtimePomXmlPath = parentPomXmlPath.getParent().resolve("runtime/pom.xml").toAbsolutePath().normalize();
+            try (Reader parentReader = Files.newBufferedReader(parentPomXmlPath, StandardCharsets.UTF_8);
+                    Reader runtimeReader = Files.newBufferedReader(runtimePomXmlPath, StandardCharsets.UTF_8)) {
+                final MavenXpp3Reader rxppReader = new MavenXpp3Reader();
+                final Model parentPom = rxppReader.read(parentReader);
+                final Model runtimePom = rxppReader.read(runtimeReader);
+                final List<Dependency> deps = runtimePom.getDependencies();
+
+                final String aid = runtimePom.getArtifactId();
+                String camelComponentArtifactId = null;
+                if (aid.equals("camel-quarkus-core")) {
+                    camelComponentArtifactId = "camel-base";
+                } else if (deps != null && !deps.isEmpty()) {
+                    Optional<Dependency> artifact = deps.stream()
+                            .filter(dep ->
+
+                                    "org.apache.camel".equals(dep.getGroupId()) &&
+                                    ("compile".equals(dep.getScope()) || dep.getScope() == null))
+                            .findFirst();
+                    if (artifact.isPresent()) {
+                        camelComponentArtifactId = artifact.get().getArtifactId();
                     }
                 }
+                final Properties props = runtimePom.getProperties() != null ? runtimePom.getProperties() : new Properties();
+
+                String name = props.getProperty("title");
+                if (name == null) {
+                    name = parentPom.getName().replace("Camel Quarkus :: ", "");
+                }
+
+                return new CamelQuarkusExtension(
+                        parentPomXmlPath,
+                        runtimePomXmlPath,
+                        camelComponentArtifactId,
+                        (String) props.get("firstVersion"),
+                        aid,
+                        name,
+                        runtimePom.getDescription(),
+                        props.getProperty("label")
+                        );
+            } catch (IOException | XmlPullParserException e) {
+                throw new RuntimeException("Could not read "+ parentPomXmlPath, e);
             }
         }
 
-        getLog().info("Found " + answer.size() + " Camel Quarkus Extensions from: " + extensionsDir);
+        private final String label;
+
+        private final String description;
+
+        private final String runtimeArtifactId;
+
+        private final Path parentPomXmlPath;
+        private final Path runtimePomXmlPath;
+        private final String camelComponentArtifactId;
+        private final String firstVersion;
+        private final String name;
+
+        public CamelQuarkusExtension(
+                Path pomXmlPath,
+                Path runtimePomXmlPath,
+                String camelComponentArtifactId,
+                String firstVersion,
+                String runtimeArtifactId,
+                String name,
+                String description,
+                String label) {
+            super();
+            this.parentPomXmlPath = pomXmlPath;
+            this.runtimePomXmlPath = runtimePomXmlPath;
+            this.camelComponentArtifactId = camelComponentArtifactId;
+            this.firstVersion = firstVersion;
+            this.runtimeArtifactId = runtimeArtifactId;
+            this.name = name;
+            this.description = description;
+            this.label = label;
+        }
+
+        public Path getParentPomXmlPath() {
+            return parentPomXmlPath;
+        }
 
-        return answer;
-    }
+        public Optional<String> getFirstVersion() {
+            return Optional.ofNullable(firstVersion);
+        }
+
+        public Path getRuntimePomXmlPath() {
+            return runtimePomXmlPath;
+        }
+
+        public Optional<String> getLabel() {
+            return Optional.ofNullable(label);
+        }
+
+        public Optional<String> getDescription() {
+            return Optional.ofNullable(description);
+        }
+
+        public String getRuntimeArtifactId() {
+            return runtimeArtifactId;
+        }
+
+        public String getCamelComponentArtifactId() {
+            return camelComponentArtifactId;
+        }
+
+        public Optional<String> getName() {
+            return Optional.ofNullable(name);
+        }
 
-    private static boolean isExcludedExtension(String name) {
-        return Arrays.asList(EXCLUDE_EXTENSIONS).contains(name);
     }
 
 }