You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2019/11/05 08:03:41 UTC

[camel-quarkus] branch master updated: Reuse camel package maven plugin to avoid duplicating code, fixes #336

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

gnodet 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 c00d493  Reuse camel package maven plugin to avoid duplicating code, fixes #336
     new 74099a2  Merge pull request #375 from gnodet/issue-336
c00d493 is described below

commit c00d4932de8cc8c1ab80e50cd3044e425dbc59cb
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Mon Nov 4 17:20:54 2019 +0100

    Reuse camel package maven plugin to avoid duplicating code, fixes #336
---
 tooling/maven/package-maven-plugin/pom.xml         |  23 ++-
 .../apache/camel/quarkus/maven/ExtMvelHelper.java  |  78 ++++++++
 .../camel/quarkus/maven/JSonSchemaHelper.java      | 222 ---------------------
 .../org/apache/camel/quarkus/maven/MvelHelper.java |  46 -----
 .../apache/camel/quarkus/maven/PackageHelper.java  |  72 -------
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   |   7 +-
 .../apache/camel/quarkus/maven/StringHelper.java   | 100 ----------
 .../quarkus/maven/UpdateDocExtensionsListMojo.java |  31 +--
 .../camel/quarkus/maven/model/AbstractModel.java   | 184 -----------------
 .../camel/quarkus/maven/model/ComponentModel.java  |  86 --------
 .../camel/quarkus/maven/model/DataFormatModel.java |  31 ---
 .../camel/quarkus/maven/model/LanguageModel.java   |  31 ---
 .../camel/quarkus/maven/model/OtherModel.java      |  34 ----
 .../src/main/resources/readme-components.mvel      |   4 +-
 .../src/main/resources/readme-dataformats.mvel     |   2 +-
 .../src/main/resources/readme-languages.mvel       |   2 +-
 .../src/main/resources/readme-others.mvel          |   2 +-
 17 files changed, 122 insertions(+), 833 deletions(-)

diff --git a/tooling/maven/package-maven-plugin/pom.xml b/tooling/maven/package-maven-plugin/pom.xml
index 2dfb81a..9fba797 100644
--- a/tooling/maven/package-maven-plugin/pom.xml
+++ b/tooling/maven/package-maven-plugin/pom.xml
@@ -46,6 +46,17 @@
 
     <dependencies>
         <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-package-maven-plugin</artifactId>
+            <version>${camel.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.codehaus.plexus</groupId>
+                    <artifactId>plexus-component-annotations</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-core</artifactId>
             <exclusions>
@@ -57,6 +68,14 @@
                     <groupId>org.codehaus.plexus</groupId>
                     <artifactId>plexus-component-annotations</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>commons-io</groupId>
+                    <artifactId>commons-io</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.google.guava</groupId>
+                    <artifactId>guava</artifactId>
+                </exclusion>
             </exclusions>
         </dependency>
         <dependency>
@@ -73,10 +92,6 @@
         </dependency>
         <dependency>
             <groupId>org.codehaus.plexus</groupId>
-            <artifactId>plexus-container-default</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-utils</artifactId>
         </dependency>
         <dependency>
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/ExtMvelHelper.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/ExtMvelHelper.java
new file mode 100644
index 0000000..ccb5af5
--- /dev/null
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/ExtMvelHelper.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.maven;
+
+import java.nio.file.Path;
+
+import org.apache.camel.maven.packaging.MvelHelper;
+import org.apache.camel.maven.packaging.StringHelper;
+import org.apache.camel.maven.packaging.model.ComponentModel;
+import org.apache.camel.maven.packaging.model.DataFormatModel;
+import org.apache.camel.maven.packaging.model.LanguageModel;
+
+public class ExtMvelHelper {
+
+    private final Path extensionsDocPath;
+
+    public ExtMvelHelper(Path extensionsDocPath) {
+        this.extensionsDocPath = extensionsDocPath;
+    }
+
+    public static String escape(final String raw) {
+        return MvelHelper.escape(raw);
+    }
+
+    public String getFirstVersionShort(Object model) {
+        return StringHelper.cutLastZeroDigit((String) invokeGetter(model, "getFirstVersion"));
+    }
+
+    public String getDocLink(Object model) {
+        if (localDocExists(model)) {
+            return getLocalDocLink(model);
+        } else if (model instanceof ComponentModel) {
+            return String.format("link:https://camel.apache.org/%s/latest/%s", "components", invokeGetter(model, "getScheme") + "-component.html");
+        } else if (model instanceof DataFormatModel) {
+            return String.format("link:https://camel.apache.org/%s/latest/%s", "components", invokeGetter(model, "getName") + "-dataformat.html");
+        } else if (model instanceof LanguageModel) {
+            return String.format("link:https://camel.apache.org/%s/latest/%s", "components", invokeGetter(model, "getName") + "-language.html");
+        } else {
+            return null;
+        }
+    }
+
+    private Object invokeGetter(Object model, String method) {
+        try {
+            return model.getClass().getMethod(method)
+                    .invoke(model);
+        } catch (Exception e) {
+            throw new RuntimeException("Unable to access " + method + " from " + model, e);
+        }
+    }
+
+    private boolean localDocExists(Object model) {
+        Path path = extensionsDocPath.resolve(getExtensionDocName(model));
+        return path.toFile().exists();
+    }
+
+    private String getLocalDocLink(Object model) {
+        return "xref:extensions/" + getExtensionDocName(model);
+    }
+
+    private String getExtensionDocName(Object model) {
+        return StringHelper.after((String) invokeGetter(model, "getArtifactId"), "camel-quarkus-") + ".adoc";
+    }
+}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/JSonSchemaHelper.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/JSonSchemaHelper.java
deleted file mode 100644
index 417aa09..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/JSonSchemaHelper.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.apache.camel.util.json.JsonObject;
-import org.apache.camel.util.json.Jsoner;
-
-
-public final class JSonSchemaHelper {
-
-    private JSonSchemaHelper() {
-    }
-
-    /**
-     * Parses the json schema to split it into a list or rows, where each row contains key value pairs with the metadata
-     *
-     * @param group the group to parse from such as <tt>component</tt>, <tt>componentProperties</tt>, or <tt>properties</tt>.
-     * @param json the json
-     * @param parseProperties parse properties or not
-     * @return a list of all the rows, where each row is a set of key value pairs with metadata
-     */
-    public static List<Map<String, String>> parseJsonSchema(String group, String json, boolean parseProperties) {
-        List<Map<String, String>> answer = new ArrayList<>();
-        if (json == null) {
-            return answer;
-        }
-
-        // convert into a List<Map<String, String>> structure which is expected as output from this parser
-        try {
-            JsonObject output = (JsonObject) Jsoner.deserialize(json);
-            for (String key : output.keySet()) {
-                Map<?, ?> row = output.getMap(key);
-                if (key.equals(group)) {
-                    if (parseProperties) {
-                        // flattern each entry in the row with name as they key, and its value as the content (its a map also)
-                        for (Object obj : row.entrySet()) {
-                            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
-                            Map<String, String> newRow = new LinkedHashMap<>();
-                            newRow.put("name", entry.getKey().toString());
-
-                            Map<String, String> newData = transformMap((Map<?, ?>) entry.getValue());
-                            newRow.putAll(newData);
-                            answer.add(newRow);
-                        }
-                    } else {
-                        // flattern each entry in the row as a list of single Map<key, value> elements
-                        Map<?, ?> newData = transformMap(row);
-                        for (Object obj : newData.entrySet()) {
-                            Map.Entry<?, ?> entry = (Map.Entry<?, ?>) obj;
-                            Map<String, String> newRow = new LinkedHashMap<>();
-                            newRow.put(entry.getKey().toString(), entry.getValue().toString());
-                            answer.add(newRow);
-                        }
-                    }
-                }
-            }
-        } catch (Exception e) {
-            // wrap parsing exceptions as runtime
-            throw new RuntimeException("Cannot parse json", e);
-        }
-
-        return answer;
-    }
-
-    private static Map<String, String> transformMap(Map<?, ?> jsonMap) {
-        Map<String, String> answer = new LinkedHashMap<>();
-
-        for (Object rowObj : jsonMap.entrySet()) {
-            Map.Entry<?, ?> rowEntry = (Map.Entry<?, ?>) rowObj;
-            // if its a list type then its an enum, and we need to parse it as a single line separated with comma
-            // to be backwards compatible
-            Object newValue = rowEntry.getValue();
-            if (newValue instanceof List) {
-                List<?> list = (List<?>) newValue;
-                newValue = list.stream().map(Object::toString)
-                        .collect(Collectors.joining(","));
-            }
-            // ensure value is escaped
-            String value = escapeJson(newValue.toString());
-            answer.put(rowEntry.getKey().toString(), value);
-        }
-
-        return answer;
-    }
-
-    private static String escapeJson(String value) {
-        // need to safe encode \r as \\r so its escaped
-        // need to safe encode \n as \\n so its escaped
-        // need to safe encode \t as \\t so its escaped
-        return value
-            .replaceAll("\\\\r", "\\\\\\r")
-            .replaceAll("\\\\n", "\\\\\\n")
-            .replaceAll("\\\\t", "\\\\\\t");
-    }
-
-    /**
-     * Gets the value with the key in a safe way, eg returning an empty string if there was no value for the key.
-     *
-     * @param key the key to search for
-     * @param rows the rows to search in
-     * @return the value found or empty string
-     */
-    public static String getSafeValue(String key, List<Map<String, String>> rows) {
-        for (Map<String, String> row : rows) {
-            String value = row.get(key);
-            if (value != null) {
-                return value;
-            }
-        }
-        return "";
-    }
-
-    /**
-     * Gets the value with the key in a safe way, eg returning an empty string if there was no value for the key.
-     *
-     * @param key the key to search for
-     * @param rows the rows to search in
-     * @return the value found or empty string
-     */
-    public static String getSafeValue(String key, Map<String, String> rows) {
-        String value = rows.get(key);
-        if (value != null) {
-            return value;
-        }
-        return "";
-    }
-
-    /**
-     *
-     * @param rows the rows to search in
-     * @param name the name to search for
-     * @return the value found or null
-     */
-    public static String getPropertyDefaultValue(List<Map<String, String>> rows, String name) {
-        for (Map<String, String> row : rows) {
-            String defaultValue = null;
-            boolean found = false;
-            if (row.containsKey("name")) {
-                found = name.equals(row.get("name"));
-            }
-            if (row.containsKey("defaultValue")) {
-                defaultValue = row.get("defaultValue");
-            }
-            if (found) {
-                return defaultValue;
-            }
-        }
-        return null;
-    }
-
-    public static String getPropertyDescriptionValue(List<Map<String, String>> rows, String name) {
-        for (Map<String, String> row : rows) {
-            String description = null;
-            boolean found = false;
-            if (row.containsKey("name")) {
-                found = name.equals(row.get("name"));
-            }
-            if (row.containsKey("description")) {
-                description = row.get("description");
-            }
-            if (found) {
-                return description;
-            }
-        }
-        return null;
-    }
-
-    public static String getPropertyJavaType(List<Map<String, String>> rows, String name) {
-        for (Map<String, String> row : rows) {
-            String javaType = null;
-            boolean found = false;
-            if (row.containsKey("name")) {
-                found = name.equals(row.get("name"));
-            }
-            if (row.containsKey("javaType")) {
-                javaType = row.get("javaType");
-            }
-            if (found) {
-                return javaType;
-            }
-        }
-        return null;
-    }
-
-    public static String getPropertyType(List<Map<String, String>> rows, String name) {
-        for (Map<String, String> row : rows) {
-            String type = null;
-            boolean found = false;
-            if (row.containsKey("name")) {
-                found = name.equals(row.get("name"));
-            }
-            if (row.containsKey("type")) {
-                type = row.get("type");
-            }
-            if (found) {
-                return type;
-            }
-        }
-        return null;
-    }
-
-}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/MvelHelper.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/MvelHelper.java
deleted file mode 100644
index 6ecb3fc..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/MvelHelper.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven;
-
-import java.util.regex.Pattern;
-
-public final class MvelHelper {
-
-    public static final MvelHelper INSTANCE = new MvelHelper();
-
-    private static final Pattern DOLLAR_ESCAPE = Pattern.compile("\\$");
-
-    private static final Pattern CURLY_BRACKET_ESCAPE = Pattern.compile("(\\{[a-zA-Z0-9]+?)\\}");
-
-    private static final Pattern URL_ESCAPE = Pattern.compile("(?<!href=\")(http(:?s)?://|(:?s)?ftp(?:s)?)");
-
-    private MvelHelper() {
-        // utility class
-    }
-
-    public static String escape(final String raw) {
-        if (raw == null) {
-            return null;
-        }
-
-        final String escapedDollars = DOLLAR_ESCAPE.matcher(raw).replaceAll("\\\\\\$");
-        final String escapedCurlyBrackets = CURLY_BRACKET_ESCAPE.matcher(escapedDollars).replaceAll("\\\\$1\\\\}");
-        final String escapedUrls = URL_ESCAPE.matcher(escapedCurlyBrackets).replaceAll("\\\\$1");
-
-        return escapedUrls;
-    }
-}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java
deleted file mode 100644
index 3f34ad5..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PackageHelper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.LineNumberReader;
-
-public final class PackageHelper {
-
-    private PackageHelper() {
-    }
-    
-    /**
-     * Loads the entire stream into memory as a String and returns it.
-     * Notice: This implementation appends a <tt>\n</tt> as line
-     * terminator at the of the text.
-     * Warning, don't use for crazy big streams :)
-     *
-     * @param in the inputStream
-     * @return the text String
-     * @throws IOException InputOutputException
-     */
-    public static String loadText(InputStream in) throws IOException {
-        StringBuilder builder = new StringBuilder();
-        InputStreamReader isr = new InputStreamReader(in);
-        try {
-            BufferedReader reader = new LineNumberReader(isr);
-            while (true) {
-                String line = reader.readLine();
-                if (line != null) {
-                    builder.append(line);
-                    builder.append("\n");
-                } else {
-                    break;
-                }
-            }
-            return builder.toString();
-        } finally {
-            isr.close();
-            in.close();
-        }
-    }
-
-    public static void writeText(File file, String text) throws IOException {
-        FileOutputStream fos = new FileOutputStream(file, false);
-        try {
-            fos.write(text.getBytes());
-        } finally {
-            fos.close();
-        }
-    }
-
-}
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 e167d1b..c59e0c8 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
@@ -50,9 +50,10 @@ import org.apache.maven.project.ProjectBuildingResult;
 import org.apache.maven.repository.RepositorySystem;
 import org.mvel2.templates.TemplateRuntime;
 
-import static org.apache.camel.quarkus.maven.PackageHelper.loadText;
-import static org.apache.camel.quarkus.maven.PackageHelper.writeText;
-import static org.apache.camel.quarkus.maven.StringHelper.camelDashToTitle;
+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
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/StringHelper.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/StringHelper.java
deleted file mode 100644
index bcc16a7..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/StringHelper.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven;
-
-public final class StringHelper {
-
-    private StringHelper() {
-        // Utils Class
-    }
-
-    public static String after(String text, String after) {
-        if (!text.contains(after)) {
-            return null;
-        }
-        return text.substring(text.indexOf(after) + after.length());
-    }
-
-    public static String before(String text, String before) {
-        if (!text.contains(before)) {
-            return null;
-        }
-        return text.substring(0, text.indexOf(before));
-    }
-
-    public static String between(String text, String after, String before) {
-        text = after(text, after);
-        if (text == null) {
-            return null;
-        }
-        return before(text, before);
-    }
-
-    public static String cutLastZeroDigit(String version) {
-        String answer = version;
-        // cut last digit so its not 2.18.0 but 2.18
-        String[] parts = version.split("\\.");
-        if (parts.length == 3 && parts[2].equals("0")) {
-            answer = parts[0] + "." + parts[1];
-        }
-        return answer;
-    }
-
-    /**
-     * Returns the base class name, i.e. without package and generic related
-     * information.
-     * 
-     * @param className The class name which base class is to be computed.
-     * @return the base class name, i.e. without package and generic related
-     *         information.
-     */
-    public static String getClassShortName(String className) {
-        if (className != null) {
-            return className.replaceAll("<.*>", "").replaceAll(".*[.]([^.]+)", "$1");
-        }
-        return className;
-    }
-
-    /**
-     * Converts the value to use title style instead of dash cased
-     */
-    public static String camelDashToTitle(String value) {
-        StringBuilder sb = new StringBuilder(value.length());
-        boolean dash = false;
-
-        for (char c : value.toCharArray()) {
-            if ('-' == c) {
-                dash = true;
-                continue;
-            }
-
-            if (dash) {
-                sb.append(' ');
-                sb.append(Character.toUpperCase(c));
-            } else {
-                // upper case first
-                if (sb.length() == 0) {
-                    sb.append(Character.toUpperCase(c));
-                } else {
-                    sb.append(c);
-                }
-            }
-            dash = false;
-        }
-        return sb.toString();
-    }
-}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateDocExtensionsListMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateDocExtensionsListMojo.java
index fbc058d..7069242 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateDocExtensionsListMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateDocExtensionsListMojo.java
@@ -19,6 +19,8 @@ package org.apache.camel.quarkus.maven;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.ArrayList;
@@ -31,10 +33,13 @@ import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.apache.camel.quarkus.maven.model.ComponentModel;
-import org.apache.camel.quarkus.maven.model.DataFormatModel;
-import org.apache.camel.quarkus.maven.model.LanguageModel;
-import org.apache.camel.quarkus.maven.model.OtherModel;
+import org.apache.camel.maven.packaging.JSonSchemaHelper;
+import org.apache.camel.maven.packaging.MvelHelper;
+import org.apache.camel.maven.packaging.StringHelper;
+import org.apache.camel.maven.packaging.model.ComponentModel;
+import org.apache.camel.maven.packaging.model.DataFormatModel;
+import org.apache.camel.maven.packaging.model.LanguageModel;
+import org.apache.camel.maven.packaging.model.OtherModel;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -46,8 +51,8 @@ import org.apache.maven.project.MavenProjectHelper;
 import org.mvel2.templates.TemplateRuntime;
 
 import static java.util.stream.Collectors.toSet;
-import static org.apache.camel.quarkus.maven.PackageHelper.loadText;
-import static org.apache.camel.quarkus.maven.PackageHelper.writeText;
+import static org.apache.camel.maven.packaging.PackageHelper.loadText;
+import static org.apache.camel.maven.packaging.PackageHelper.writeText;
 
 /**
  * Updates the documentation in:
@@ -425,7 +430,7 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
             map.put("components", models);
             map.put("numberOfArtifacts", artifacts);
             map.put("numberOfDeprecated", deprecated);
-            String out = (String) TemplateRuntime.eval(template, map, Collections.singletonMap("util", MvelHelper.INSTANCE));
+            String out = (String) TemplateRuntime.eval(template, map, Collections.singletonMap("util", new ExtMvelHelper(getExtensionsDocPath())));
             return out;
         } catch (Exception e) {
             throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e);
@@ -439,7 +444,7 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
             map.put("dataformats", models);
             map.put("numberOfArtifacts", artifacts);
             map.put("numberOfDeprecated", deprecated);
-            String out = (String) TemplateRuntime.eval(template, map, Collections.singletonMap("util", MvelHelper.INSTANCE));
+            String out = (String) TemplateRuntime.eval(template, map, Collections.singletonMap("util", new ExtMvelHelper(getExtensionsDocPath())));
             return out;
         } catch (Exception e) {
             throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e);
@@ -453,7 +458,7 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
             map.put("languages", models);
             map.put("numberOfArtifacts", artifacts);
             map.put("numberOfDeprecated", deprecated);
-            String out = (String) TemplateRuntime.eval(template, map, Collections.singletonMap("util", MvelHelper.INSTANCE));
+            String out = (String) TemplateRuntime.eval(template, map, Collections.singletonMap("util", new ExtMvelHelper(getExtensionsDocPath())));
             return out;
         } catch (Exception e) {
             throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e);
@@ -467,7 +472,7 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
             map.put("others", models);
             map.put("numberOfArtifacts", artifacts);
             map.put("numberOfDeprecated", deprecated);
-            String out = (String) TemplateRuntime.eval(template, map, Collections.singletonMap("util", MvelHelper.INSTANCE));
+            String out = (String) TemplateRuntime.eval(template, map, Collections.singletonMap("util", new ExtMvelHelper(getExtensionsDocPath())));
             return out;
         } catch (Exception e) {
             throw new MojoExecutionException("Error processing mvel template. Reason: " + e, e);
@@ -651,7 +656,7 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
     private ComponentModel generateComponentModel(String json) {
         List<Map<String, String>> rows = JSonSchemaHelper.parseJsonSchema("component", json, false);
 
-        ComponentModel component = new ComponentModel();
+        ComponentModel component = new ComponentModel(false);
         component.setScheme(JSonSchemaHelper.getSafeValue("scheme", rows));
         component.setSyntax(JSonSchemaHelper.getSafeValue("syntax", rows));
         component.setAlternativeSyntax(JSonSchemaHelper.getSafeValue("alternativeSyntax", rows));
@@ -668,7 +673,6 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
         component.setGroupId(JSonSchemaHelper.getSafeValue("groupId", rows));
         component.setArtifactId(JSonSchemaHelper.getSafeValue("artifactId", rows));
         component.setVersion(JSonSchemaHelper.getSafeValue("version", rows));
-        component.setExtensionsDocPath(getExtensionsDocPath());
 
         return component;
     }
@@ -689,7 +693,6 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
         dataFormat.setGroupId(JSonSchemaHelper.getSafeValue("groupId", rows));
         dataFormat.setArtifactId(JSonSchemaHelper.getSafeValue("artifactId", rows));
         dataFormat.setVersion(JSonSchemaHelper.getSafeValue("version", rows));
-        dataFormat.setExtensionsDocPath(getExtensionsDocPath());
 
         return dataFormat;
     }
@@ -710,7 +713,6 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
         language.setGroupId(JSonSchemaHelper.getSafeValue("groupId", rows));
         language.setArtifactId(JSonSchemaHelper.getSafeValue("artifactId", rows));
         language.setVersion(JSonSchemaHelper.getSafeValue("version", rows));
-        language.setExtensionsDocPath(getExtensionsDocPath());
 
         return language;
     }
@@ -729,7 +731,6 @@ public class UpdateDocExtensionsListMojo extends AbstractMojo {
         other.setGroupId(JSonSchemaHelper.getSafeValue("groupId", rows));
         other.setArtifactId(JSonSchemaHelper.getSafeValue("artifactId", rows));
         other.setVersion(JSonSchemaHelper.getSafeValue("version", rows));
-        other.setExtensionsDocPath(getExtensionsDocPath());
 
         return other;
     }
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/AbstractModel.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/AbstractModel.java
deleted file mode 100644
index aadcf82..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/AbstractModel.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven.model;
-
-import java.nio.file.Path;
-
-import org.apache.camel.quarkus.maven.StringHelper;
-import static org.apache.camel.quarkus.maven.StringHelper.cutLastZeroDigit;
-
-public abstract class AbstractModel {
-
-    private String kind;
-    private String name;
-    private String modelName;
-    private String title;
-    private String description;
-    private String firstVersion;
-    private String label;
-    private String deprecated;
-    private String deprecationNote;
-    private String javaType;
-    private String groupId;
-    private String artifactId;
-    private String version;
-    private Path extensionsDocPath;
-
-    public String getKind() {
-        return kind;
-    }
-
-    public void setKind(String kind) {
-        this.kind = kind;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getModelName() {
-        return modelName;
-    }
-
-    public void setModelName(String modelName) {
-        this.modelName = modelName;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public String getFirstVersion() {
-        return firstVersion;
-    }
-
-    public void setFirstVersion(String firstVersion) {
-        this.firstVersion = firstVersion;
-    }
-
-    public String getLabel() {
-        return label;
-    }
-
-    public void setLabel(String label) {
-        this.label = label;
-    }
-
-    public String getDeprecated() {
-        return deprecated;
-    }
-
-    public void setDeprecated(String deprecated) {
-        this.deprecated = deprecated;
-    }
-
-    public String getDeprecationNote() {
-        return deprecationNote;
-    }
-
-    public void setDeprecationNote(String deprecationNote) {
-        this.deprecationNote = deprecationNote;
-    }
-
-    public String getJavaType() {
-        return javaType;
-    }
-
-    public void setJavaType(String javaType) {
-        this.javaType = javaType;
-    }
-
-    public String getGroupId() {
-        return groupId;
-    }
-
-    public void setGroupId(String groupId) {
-        this.groupId = groupId;
-    }
-
-    public String getArtifactId() {
-        return artifactId;
-    }
-
-    public void setArtifactId(String artifactId) {
-        this.artifactId = artifactId;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
-    public String getShortJavaType() {
-        return StringHelper.getClassShortName(javaType);
-    }
-
-    public boolean localDocExists() {
-        Path path = extensionsDocPath.resolve(getExtensionDocName());
-        return path.toFile().exists();
-    }
-
-    public Path getExtensionsDocPath() {
-        return extensionsDocPath;
-    }
-
-    public void setExtensionsDocPath(Path extensionsDocPath) {
-        this.extensionsDocPath = extensionsDocPath;
-    }
-
-    public String getLocalDocLink() {
-        return "xref:extensions/" + getExtensionDocName();
-    }
-
-    public String getExtensionDocName() {
-        return StringHelper.after(artifactId, "camel-quarkus-") + ".adoc";
-    }
-
-    public String getDocLink() {
-        if (localDocExists()) {
-            return getLocalDocLink();
-        }
-        return String.format("link:https://camel.apache.org/%s/latest/%s", getDocLinkSection(), getDocLinkDocument());
-    }
-
-    public String getFirstVersionShort() {
-        return cutLastZeroDigit(firstVersion);
-    }
-
-    abstract String getDocLinkSection();
-    abstract String getDocLinkDocument();
-
-}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/ComponentModel.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/ComponentModel.java
deleted file mode 100644
index ca52b64..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/ComponentModel.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven.model;
-
-public class ComponentModel extends AbstractModel {
-
-    private String scheme;
-    private String syntax;
-    private String alternativeSyntax;
-    private String alternativeSchemes;
-    private String consumerOnly;
-    private String producerOnly;
-
-    public String getScheme() {
-        return scheme;
-    }
-
-    public void setScheme(String scheme) {
-        this.scheme = scheme;
-    }
-
-    public String getSyntax() {
-        return syntax;
-    }
-
-    public void setSyntax(String syntax) {
-        this.syntax = syntax;
-    }
-
-    public String getAlternativeSyntax() {
-        return alternativeSyntax;
-    }
-
-    public void setAlternativeSyntax(String alternativeSyntax) {
-        this.alternativeSyntax = alternativeSyntax;
-    }
-
-    public String getAlternativeSchemes() {
-        return alternativeSchemes;
-    }
-
-    public void setAlternativeSchemes(String alternativeSchemes) {
-        this.alternativeSchemes = alternativeSchemes;
-    }
-
-    public String getConsumerOnly() {
-        return consumerOnly;
-    }
-
-    public void setConsumerOnly(String consumerOnly) {
-        this.consumerOnly = consumerOnly;
-    }
-
-    public String getProducerOnly() {
-        return producerOnly;
-    }
-
-    public void setProducerOnly(String producerOnly) {
-        this.producerOnly = producerOnly;
-    }
-
-    @Override
-    String getDocLinkSection() {
-        return "components";
-    }
-
-    @Override
-    String getDocLinkDocument() {
-        return scheme + "-component.html";
-    }
-
-}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/DataFormatModel.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/DataFormatModel.java
deleted file mode 100644
index 16d83d2..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/DataFormatModel.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven.model;
-
-public class DataFormatModel extends AbstractModel {
-
-    @Override
-    String getDocLinkSection() {
-        return "components";
-    }
-
-    @Override
-    String getDocLinkDocument() {
-        return getName() + "-dataformat.html";
-    }
-
-}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/LanguageModel.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/LanguageModel.java
deleted file mode 100644
index c72dfab..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/LanguageModel.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven.model;
-
-public class LanguageModel extends AbstractModel {
-
-    @Override
-    String getDocLinkSection() {
-        return "components";
-    }
-
-    @Override
-    String getDocLinkDocument() {
-        return getName() + "-language.html";
-    }
-
-}
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/OtherModel.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/OtherModel.java
deleted file mode 100644
index ea213da..0000000
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/model/OtherModel.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.quarkus.maven.model;
-
-public class OtherModel extends AbstractModel {
-
-    public String getDocLink() {
-        return localDocExists() ? getLocalDocLink() : null;
-    }
-
-    @Override
-    String getDocLinkSection() {
-        return null;
-    }
-
-    @Override
-    String getDocLinkDocument() {
-        return null;
-    }
-}
diff --git a/tooling/maven/package-maven-plugin/src/main/resources/readme-components.mvel b/tooling/maven/package-maven-plugin/src/main/resources/readme-components.mvel
index 4904ef1..fe78049 100644
--- a/tooling/maven/package-maven-plugin/src/main/resources/readme-components.mvel
+++ b/tooling/maven/package-maven-plugin/src/main/resources/readme-components.mvel
@@ -6,8 +6,8 @@ Number of Camel components: @{components.size} in @{numberOfArtifacts} JAR artif
 |===
 | Component | Since | Description
 @foreach{row : components}
-| @{row.docLink}[@{row.title}] (@{row.artifactId}) +
-`@{row.syntax}` | @{row.firstVersionShort} | @if{row.deprecated == "true"}*deprecated* @end{}@{util.escape(row.description)}
+| @{util.getDocLink(row)}[@{row.title}] (@{row.artifactId}) +
+`@{row.syntax}` | @{util.getFirstVersionShort(row)} | @if{row.deprecated == "true"}*deprecated* @end{}@{util.escape(row.description)}
 @end{}
 |===
 
diff --git a/tooling/maven/package-maven-plugin/src/main/resources/readme-dataformats.mvel b/tooling/maven/package-maven-plugin/src/main/resources/readme-dataformats.mvel
index e436114..e721ce1 100644
--- a/tooling/maven/package-maven-plugin/src/main/resources/readme-dataformats.mvel
+++ b/tooling/maven/package-maven-plugin/src/main/resources/readme-dataformats.mvel
@@ -6,7 +6,7 @@ Number of Camel data formats: @{dataformats.size} in @{numberOfArtifacts} JAR ar
 |===
 | Data Format | Since | Description
 @foreach{row : dataformats}
-| @{row.docLink}[@{row.title}] (@{row.artifactId}) | @{row.firstVersionShort} | @if{row.deprecated == "true"}*deprecated* @end{}@{util.escape(row.description)}
+| @{util.getDocLink(row)}[@{row.title}] (@{row.artifactId}) | @{util.getFirstVersionShort(row)} | @if{row.deprecated == "true"}*deprecated* @end{}@{util.escape(row.description)}
 @end{}|===
 
 @end{}
\ No newline at end of file
diff --git a/tooling/maven/package-maven-plugin/src/main/resources/readme-languages.mvel b/tooling/maven/package-maven-plugin/src/main/resources/readme-languages.mvel
index 28df02b..b63e42a 100644
--- a/tooling/maven/package-maven-plugin/src/main/resources/readme-languages.mvel
+++ b/tooling/maven/package-maven-plugin/src/main/resources/readme-languages.mvel
@@ -6,7 +6,7 @@ Number of Camel languages: @{languages.size} in @{numberOfArtifacts} JAR artifac
 |===
 | Language | Since | Description
 @foreach{row : languages}
-| @{row.docLink}[@{row.title}] (@{row.artifactId}) | @{row.firstVersionShort} | @if{row.deprecated == "true"}*deprecated* @end{}@{util.escape(row.description)}
+| @{util.getDocLink(row)}[@{row.title}] (@{row.artifactId}) | @{util.getFirstVersionShort(row)} | @if{row.deprecated == "true"}*deprecated* @end{}@{util.escape(row.description)}
 @end{}|===
 
 @end{}
\ No newline at end of file
diff --git a/tooling/maven/package-maven-plugin/src/main/resources/readme-others.mvel b/tooling/maven/package-maven-plugin/src/main/resources/readme-others.mvel
index e873d89..a948973 100644
--- a/tooling/maven/package-maven-plugin/src/main/resources/readme-others.mvel
+++ b/tooling/maven/package-maven-plugin/src/main/resources/readme-others.mvel
@@ -6,7 +6,7 @@ Number of miscellaneous extensions: @{others.size} in @{numberOfArtifacts} JAR a
 |===
 | Extension | Since | Description
 @foreach{row : others}
-|@if{row.docLink != null} @{row.docLink}[@{row.artifactId}] @else{} (@{row.artifactId})@end{} | @{row.firstVersionShort} | @if{row.deprecated == "true"}*deprecated* @end{}@{util.escape(row.description)}
+|@if{util.getDocLink(row) != null} @{util.getDocLink(row)}[@{row.artifactId}] @else{} (@{row.artifactId})@end{} | @{util.getFirstVersionShort(row)} | @if{row.deprecated == "true"}*deprecated* @end{}@{util.escape(row.description)}
 @end{}|===
 
 @end{}
\ No newline at end of file