Repository: camel
Updated Branches:
  refs/heads/master f98f5c581 -> 4921ffe8c


CAMEL-8379: Camel catalog - Include xml schema and maven archetype catalog


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7d9038c3
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7d9038c3
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7d9038c3

Branch: refs/heads/master
Commit: 7d9038c363568485b89da014ebadce36f627c748
Parents: f98f5c5
Author: Claus Ibsen <davscl...@apache.org>
Authored: Thu Feb 19 10:15:54 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Thu Feb 19 10:15:54 2015 +0100

----------------------------------------------------------------------
 platforms/catalog/pom.xml                       |  5 +--
 .../maven/packaging/PrepareCatalogMojo.java     | 38 ++++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7d9038c3/platforms/catalog/pom.xml
----------------------------------------------------------------------
diff --git a/platforms/catalog/pom.xml b/platforms/catalog/pom.xml
index 65d87ec..01110b2 100644
--- a/platforms/catalog/pom.xml
+++ b/platforms/catalog/pom.xml
@@ -33,10 +33,11 @@
   <properties>
     <camel.osgi.export.pkg>
       org.apache.camel.catalog,
-      org.apache.camel.catalog.models,
+      org.apache.camel.catalog.archetypes,
       org.apache.camel.catalog.components,
       org.apache.camel.catalog.dataformats,
-      org.apache.camel.catalog.languages
+      org.apache.camel.catalog.languages,
+      org.apache.camel.catalog.models
     </camel.osgi.export.pkg>
   </properties>
 

http://git-wip-us.apache.org/repos/asf/camel/blob/7d9038c3/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
index 38b4ffc..9c2f1fe 100644
--- 
a/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
+++ 
b/tooling/maven/camel-package-maven-plugin/src/main/java/org/apache/camel/maven/packaging/PrepareCatalogMojo.java
@@ -90,20 +90,34 @@ public class PrepareCatalogMojo extends AbstractMojo {
     protected File modelsOutDir;
 
     /**
+     * The output directory for archetypes catalog
+     *
+     * @parameter 
default-value="${project.build.directory}/classes/org/apache/camel/catalog/archetypes"
+     */
+    protected File archetypesOutDir;
+
+    /**
      * The components directory where all the Apache Camel components are
      *
-     * @parameter 
default-value="${project.build.directory}/../../..//components"
+     * @parameter 
default-value="${project.build.directory}/../../../components"
      */
     protected File componentsDir;
 
     /**
      * The camel-core directory where camel-core components are
      *
-     * @parameter 
default-value="${project.build.directory}/../../..//camel-core"
+     * @parameter 
default-value="${project.build.directory}/../../../camel-core"
      */
     protected File coreDir;
 
     /**
+     * The archetypes directory where all the Apache Camel Maven archetypes are
+     *
+     * @parameter 
default-value="${project.build.directory}/../../../tooling/archetypes"
+     */
+    protected File archetypesDir;
+
+    /**
      * Maven ProjectHelper.
      *
      * @component
@@ -123,6 +137,7 @@ public class PrepareCatalogMojo extends AbstractMojo {
         executeComponents();
         executeDataFormats();
         executeLanguages();
+        executeArchetypes();
     }
 
     protected void executeModel() throws MojoExecutionException, 
MojoFailureException {
@@ -588,6 +603,25 @@ public class PrepareCatalogMojo extends AbstractMojo {
         printLanguagesReport(jsonFiles, duplicateJsonFiles, missingLabels, 
usedLabels);
     }
 
+    protected void executeArchetypes() throws MojoExecutionException, 
MojoFailureException {
+        getLog().info("Copying Archetype Catalog");
+
+        // find the generate catalog
+        File file = new File(archetypesDir, 
"target/classes/archetype-catalog.xml");
+
+        // make sure to create out dir
+        archetypesOutDir.mkdirs();
+
+        if (file.exists() && file.isFile()) {
+            File to = new File(archetypesOutDir, file.getName());
+            try {
+                copyFile(file, to);
+            } catch (IOException e) {
+                throw new MojoFailureException("Cannot copy file from " + file 
+ " -> " + to, e);
+            }
+        }
+    }
+
     private void printModelsReport(Set<File> json, Set<File> duplicate, 
Set<File> missingLabels, Map<String, Set<String>> usedLabels, Set<File> 
missingJavaDoc) {
         
getLog().info("================================================================================");
 

Reply via email to