Repository: camel
Updated Branches:
  refs/heads/master 55d4f227f -> 7ebe33322


CAMEL-8197: Include eip enhanced xsd schema in the generated JAR. Need a bit of 
maven phase shuffle to make the plugins run in correct order.


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

Branch: refs/heads/master
Commit: 89869b6b265b641d89245753f8cce3e14af121af
Parents: 55d4f22
Author: Claus Ibsen <davscl...@apache.org>
Authored: Tue Feb 10 13:28:07 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Tue Feb 10 13:28:07 2015 +0100

----------------------------------------------------------------------
 components/camel-spring/pom.xml                 | 76 +++++++++++++-------
 .../maven/EipDocumentationEnricherMojo.java     |  2 +-
 2 files changed, 52 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/89869b6b/components/camel-spring/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml
index 4714cab..ac0a76b 100644
--- a/components/camel-spring/pom.xml
+++ b/components/camel-spring/pom.xml
@@ -255,22 +255,6 @@
         </dependencies>
         <executions>
           <execution>
-            <id>package</id>
-            <phase>package</phase>
-            <configuration>
-              <target>
-                <echo>Including source code from camel-core-xml in the 
camel-spring-sources.jar</echo>
-                <jar 
destfile="${project.build.directory}/${project.artifactId}-${project.version}-sources.jar"
 update="true">
-                  <fileset dir="${basedir}/../camel-core-osgi/src/main/java" 
includes="**/*" />
-                  <fileset dir="${basedir}/../camel-core-xml/src/main/java" 
includes="**/*" />
-                </jar>
-              </target>
-            </configuration>
-            <goals>
-              <goal>run</goal>
-            </goals>
-          </execution>
-          <execution>
             <id>generate-sources</id>
             <phase>process-classes</phase>
             <configuration>
@@ -323,12 +307,6 @@
                     <schema namespace="http://camel.apache.org/schema/spring"; 
file="camel-spring.xsd" />
                     <classpath refid="maven.compile.classpath" />
                 </schemagen>
-                <copy 
file="${project.build.directory}/schema/camel-spring.xsd" 
tofile="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd"
 />
-                <replace 
file="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd"
 token="http://camel.apache.org/schema/spring"; 
value="http://camel.apache.org/schema/spring/v${camel.schema.version}"; />
-
-                <copy todir="${project.build.directory}/classes">
-                  <fileset dir="${project.build.directory}/schema" />
-                </copy>
 
               </target>
             </configuration>
@@ -336,6 +314,22 @@
               <goal>run</goal>
             </goals>
           </execution>
+          <execution>
+            <id>package</id>
+            <phase>package</phase>
+            <configuration>
+              <target>
+                <echo>Including source code from camel-core-xml in the 
camel-spring-sources.jar</echo>
+                <jar 
destfile="${project.build.directory}/${project.artifactId}-${project.version}-sources.jar"
 update="true">
+                  <fileset dir="${basedir}/../camel-core-osgi/src/main/java" 
includes="**/*" />
+                  <fileset dir="${basedir}/../camel-core-xml/src/main/java" 
includes="**/*" />
+                </jar>
+              </target>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
         </executions>
       </plugin>
       <plugin>
@@ -369,7 +363,7 @@
             <configuration>
               <artifacts>
                 <artifact>
-                  
<file>${project.build.directory}/schema/camel-spring.xsd</file>
+                  
<file>${project.build.directory}/classes/camel-spring.xsd</file>
                   <type>xsd</type>
                 </artifact>
               </artifacts>
@@ -377,19 +371,51 @@
           </execution>
         </executions>
       </plugin>
+      <!-- after the eip-documentation-enricher we need to copy some shchema 
files -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>package</id>
+            <phase>prepare-package</phase>
+            <configuration>
+              <target>
+                <echo>Copying XSD schema to be included in JAR</echo>
+                <copy 
file="${project.build.directory}/classes/camel-spring.xsd"
+                      
tofile="${project.build.directory}/schema/camel-spring.xsd"/>
+                <copy 
file="${project.build.directory}/classes/camel-spring.xsd"
+                      
tofile="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd"/>
+                <replace 
file="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd"
+                         token="http://camel.apache.org/schema/spring";
+                         
value="http://camel.apache.org/schema/spring/v${camel.schema.version}"/>
+                <!-- copy modified schemas back again in classes so they are 
included in the JAR -->
+                <copy todir="${project.build.directory}/classes">
+                  <fileset dir="${project.build.directory}/schema"/>
+                </copy>
+              </target>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.camel</groupId>
         <artifactId>camel-eip-documentation-enricher-maven-plugin</artifactId>
+        <version>${project.version}</version>
         <executions>
           <execution>
             <id>eip-documentation-enricher</id>
-            <phase>package</phase>
+            <!-- need to run earlier so we use the process-test-resources 
phase -->
+            <phase>process-test-resources</phase>
             <goals>
               <goal>eip-documentation-enricher</goal>
             </goals>
             <configuration>
               
<inputCamelSchemaFile>${project.build.directory}/schema/camel-spring.xsd</inputCamelSchemaFile>
-              
<outputCamelSchemaFile>${project.build.directory}/schema/camel-spring.xsd</outputCamelSchemaFile>
+              
<outputCamelSchemaFile>${project.build.directory}/classes/camel-spring.xsd</outputCamelSchemaFile>
             </configuration>
           </execution>
         </executions>

http://git-wip-us.apache.org/repos/asf/camel/blob/89869b6b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
----------------------------------------------------------------------
diff --git 
a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
 
b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
index 4c2ddd0..e7f482c 100644
--- 
a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
+++ 
b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
@@ -52,7 +52,7 @@ import org.apache.maven.plugins.annotations.ResolutionScope;
  * Injects EIP documentation to camel schema.
  */
 @Mojo(name = "eip-documentation-enricher", requiresDependencyResolution = 
ResolutionScope.COMPILE_PLUS_RUNTIME, requiresProject = true,
-        defaultPhase = LifecyclePhase.PACKAGE)
+        defaultPhase = LifecyclePhase.PREPARE_PACKAGE)
 public class EipDocumentationEnricherMojo extends AbstractMojo {
 
     /**

Reply via email to