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 2020/03/23 12:26:02 UTC

[camel] branch master updated: CAMEL-14715: Use sources JARs for generating XSD in spring/blueprint so they can be separated.

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.git


The following commit(s) were added to refs/heads/master by this push:
     new 42eabb8  CAMEL-14715: Use sources JARs for generating XSD in spring/blueprint so they can be separated.
42eabb8 is described below

commit 42eabb88304ff3105304b6c5ba45613bc9473dc2
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Mar 23 13:25:28 2020 +0100

    CAMEL-14715: Use sources JARs for generating XSD in spring/blueprint so they can be separated.
---
 components/camel-blueprint/pom.xml | 153 ++++++++++++++++++++++++-------------
 components/camel-spring/pom.xml    |  76 ++++++++++++++----
 core/pom.xml                       |  15 ++++
 3 files changed, 177 insertions(+), 67 deletions(-)

diff --git a/components/camel-blueprint/pom.xml b/components/camel-blueprint/pom.xml
index 173f06c..173783f 100644
--- a/components/camel-blueprint/pom.xml
+++ b/components/camel-blueprint/pom.xml
@@ -17,7 +17,8 @@
     limitations under the License.
 
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
@@ -175,7 +176,7 @@
                                         </goals>
                                     </pluginExecutionFilter>
                                     <action>
-                                        <ignore />
+                                        <ignore/>
                                     </action>
                                 </pluginExecution>
                             </pluginExecutions>
@@ -342,9 +343,7 @@
             </build>
         </profile>
 
-        <!-- The next three profiles are used to bypass the schemagen plugin on HP and IBM JDKs.
-             TODO: Whenever Maven supports profile activations based on multiple properties, we
-             should combine the on-ibmjdk and on-hpjdk profiles as they do exactly the same thing. -->
+        <!-- XML XSD schema generator -->
         <profile>
             <id>enable-schemagen</id>
             <activation>
@@ -352,9 +351,67 @@
                     <name>!disable-schemagen</name>
                 </property>
             </activation>
-
             <build>
                 <plugins>
+                    <!-- unpack sources which are needed for the scheme generator -->
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-dependency-plugin</artifactId>
+                        <version>3.1.2</version>
+                        <executions>
+                            <execution>
+                                <id>process-sources</id>
+                                <phase>process-resources</phase>
+                                <goals>
+                                    <goal>unpack</goal>
+                                </goals>
+                                <configuration>
+                                    <artifactItems>
+                                        <artifactItem>
+                                            <groupId>org.apache.camel</groupId>
+                                            <artifactId>camel-api</artifactId>
+                                            <version>${project.version}</version>
+                                            <type>jar</type>
+                                            <classifier>sources</classifier>
+                                            <overWrite>true</overWrite>
+                                            <outputDirectory>target/sources/camel-api</outputDirectory>
+                                            <includes>**/*.java</includes>
+                                        </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.apache.camel</groupId>
+                                            <artifactId>camel-core-engine</artifactId>
+                                            <version>${project.version}</version>
+                                            <type>jar</type>
+                                            <classifier>sources</classifier>
+                                            <overWrite>true</overWrite>
+                                            <outputDirectory>target/sources/camel-core-engine</outputDirectory>
+                                            <includes>**/*.java</includes>
+                                        </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.apache.camel</groupId>
+                                            <artifactId>camel-core-xml</artifactId>
+                                            <version>${project.version}</version>
+                                            <type>jar</type>
+                                            <classifier>sources</classifier>
+                                            <overWrite>true</overWrite>
+                                            <outputDirectory>target/sources/camel-core-xml</outputDirectory>
+                                            <includes>**/*.java</includes>
+                                        </artifactItem>
+                                        <artifactItem>
+                                            <groupId>org.apache.camel</groupId>
+                                            <artifactId>camel-util</artifactId>
+                                            <version>${project.version}</version>
+                                            <type>jar</type>
+                                            <classifier>sources</classifier>
+                                            <overWrite>true</overWrite>
+                                            <outputDirectory>target/sources/camel-util</outputDirectory>
+                                            <includes>**/*.java</includes>
+                                        </artifactItem>
+                                    </artifactItems>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-antrun-plugin</artifactId>
@@ -366,38 +423,38 @@
                                 <phase>process-classes</phase>
                                 <configuration>
                                     <target>
-                                        <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" />
-
+                                        <taskdef resource="net/sf/antcontrib/antcontrib.properties"
+                                                 classpathref="maven.plugin.classpath"/>
                                         <echo>Copying to code together for the XSD generation</echo>
-                                        <mkdir dir="${project.build.directory}/schema-src" />
-                                        <mkdir dir="${project.build.directory}/schema" />
-                                        <mkdir dir="${project.build.directory}/schema/META-INF/JAXB" />
+                                        <mkdir dir="${project.build.directory}/schema-src"/>
+                                        <mkdir dir="${project.build.directory}/schema"/>
+                                        <mkdir dir="${project.build.directory}/schema/META-INF/JAXB"/>
                                         <copy todir="${project.build.directory}/schema-src">
                                             <fileset dir="${basedir}/src/main/java">
-                                                <include name="org/apache/camel/blueprint/Camel*.java" />
-                                                <include name="org/apache/camel/blueprint/ErrorHandler*.java" />
-                                                <include name="org/apache/camel/blueprint/package-info.java" />
-                                                <include name="org/apache/camel/util/blueprint/**/*.java" />
+                                                <include name="org/apache/camel/blueprint/Camel*.java"/>
+                                                <include name="org/apache/camel/blueprint/ErrorHandler*.java"/>
+                                                <include name="org/apache/camel/blueprint/package-info.java"/>
+                                                <include name="org/apache/camel/util/blueprint/**/*.java"/>
                                             </fileset>
-                                            <fileset dir="${basedir}/../../core/camel-core-xml/src/main/java">
-                                                <include name="org/apache/camel/core/xml/*.java" />
-                                                <include name="org/apache/camel/core/xml/util/**/*.java" />
-                                                <exclude name="org/apache/camel/core/xml/CamelProxyFactoryDefinition.java" />
+                                            <fileset dir="${project.build.directory}/sources/camel-core-xml">
+                                                <include name="org/apache/camel/core/xml/*.java"/>
+                                                <include name="org/apache/camel/core/xml/util/**/*.java"/>
+                                                <exclude name="org/apache/camel/core/xml/CamelProxyFactoryDefinition.java"/>
                                             </fileset>
-                                            <fileset dir="${basedir}/../../core/camel-api/src/main/java">
-                                                <include name="org/apache/camel/ExchangePattern.java" />
-                                                <include name="org/apache/camel/LoggingLevel.java" />
-                                                <include name="org/apache/camel/ManagementStatisticsLevel.java" />
-                                                <include name="org/apache/camel/ShutdownRoute.java" />
-                                                <include name="org/apache/camel/ShutdownRunningTask.java" />
-                                                <include name="org/apache/camel/WaitForTaskToComplete.java" />
+                                            <fileset dir="${project.build.directory}/sources/camel-api">
+                                                <include name="org/apache/camel/ExchangePattern.java"/>
+                                                <include name="org/apache/camel/LoggingLevel.java"/>
+                                                <include name="org/apache/camel/ManagementStatisticsLevel.java"/>
+                                                <include name="org/apache/camel/ShutdownRoute.java"/>
+                                                <include name="org/apache/camel/ShutdownRunningTask.java"/>
+                                                <include name="org/apache/camel/WaitForTaskToComplete.java"/>
                                             </fileset>
-                                            <fileset dir="${basedir}/../../core/camel-core-engine/src/main/java">
-                                                <include name="org/apache/camel/model/**/*.java" />
-                                                <include name="org/apache/camel/package-info.java" />
+                                            <fileset dir="${project.build.directory}/sources/camel-core-engine">
+                                                <include name="org/apache/camel/model/**/*.java"/>
+                                                <include name="org/apache/camel/package-info.java"/>
                                             </fileset>
-                                            <fileset dir="${basedir}/../../core/camel-util/src/main/java">
-                                                <include name="org/apache/camel/util/concurrent/ThreadPoolRejectedPolicy.java" />
+                                            <fileset dir="${project.build.directory}/sources/camel-util">
+                                                <include name="org/apache/camel/util/concurrent/ThreadPoolRejectedPolicy.java"/>
                                             </fileset>
                                         </copy>
                                     </target>
@@ -407,25 +464,6 @@
                                     <goal>run</goal>
                                 </goals>
                             </execution>
-                            <execution>
-                                <id>include-sources</id>
-                                <phase>package</phase>
-                                <configuration>
-                                    <target>
-                                        <echo>Including source code from camel-core-xml in the
-                                            camel-blueprint-sources.jar
-                                        </echo>
-                                        <jar destfile="${project.build.directory}/${project.artifactId}-${project.version}-sources.jar" update="true">
-                                            <fileset dir="${basedir}/../../core/camel-core-osgi/src/main/java" includes="**/*" />
-                                            <fileset dir="${basedir}/../../core/camel-core-xml/src/main/java" includes="**/*" />
-                                            <fileset dir="${basedir}/src/main/java" includes="**/*" />
-                                        </jar>
-                                    </target>
-                                </configuration>
-                                <goals>
-                                    <goal>run</goal>
-                                </goals>
-                            </execution>
                             <!-- after the eip-documentation-enricher we need to copy some schema files -->
                             <execution>
                                 <id>include-schemas</id>
@@ -433,16 +471,20 @@
                                 <configuration>
                                     <target>
                                         <echo>Copying XSD schema to be included in JAR</echo>
-                                        <replace file="${project.build.directory}/schema/camel-blueprint.xsd" token="xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;" value="xs:schema xmlns=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;" />
-                                        <replace file="${project.build.directory}/schema/camel-blueprint.xsd" token="http://camel.apache.org/schema/spring" value="http://camel.apache.org/schema/blueprint" />
+                                        <replace file="${project.build.directory}/schema/camel-blueprint.xsd"
+                                                 token="xs:schema xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;"
+                                                 value="xs:schema xmlns=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;"/>
+                                        <replace file="${project.build.directory}/schema/camel-blueprint.xsd"
+                                                 token="http://camel.apache.org/schema/spring"
+                                                 value="http://camel.apache.org/schema/blueprint"/>
                                         <copy todir="${project.build.directory}/classes">
                                             <fileset dir="${project.build.directory}/schema">
-                                                <exclude name="**/*.class" />
+                                                <exclude name="**/*.class"/>
                                             </fileset>
                                         </copy>
                                         <!-- copy modified schemas back again in classes so they are included in the JAR -->
                                         <fileset dir="${project.build.directory}/schema">
-                                            <exclude name="**/*.class" />
+                                            <exclude name="**/*.class"/>
                                         </fileset>
                                     </target>
                                 </configuration>
@@ -455,7 +497,9 @@
                 </plugins>
             </build>
         </profile>
+
         <profile>
+            <!-- Bypass the schemagen plugin on HP and IBM JDKs. -->
             <id>on-ibmjdk</id>
             <activation>
                 <property>
@@ -482,6 +526,7 @@
             </build>
         </profile>
         <profile>
+            <!-- Bypass the schemagen plugin on HP and IBM JDKs. -->
             <id>on-hpjdk</id>
             <activation>
                 <property>
diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml
index f0d8cd0..d35e333 100644
--- a/components/camel-spring/pom.xml
+++ b/components/camel-spring/pom.xml
@@ -221,15 +221,6 @@
                     <exclude>**/*.class</exclude>
                 </excludes>
             </resource>
-            <!--
-            <resource>
-              <directory>src/main/resources</directory>
-              <includes>
-                <include>**/*</include>
-              </includes>
-              <filtering>true</filtering>
-            </resource>
-            -->
         </resources>
         <pluginManagement>
             <plugins>
@@ -361,6 +352,65 @@
                 </configuration>
             </plugin>
 
+            <!-- unpack sources which are needed for the scheme generator -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>3.1.2</version>
+                <executions>
+                    <execution>
+                        <id>process-sources</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>org.apache.camel</groupId>
+                                    <artifactId>camel-api</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>jar</type>
+                                    <classifier>sources</classifier>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>target/sources/camel-api</outputDirectory>
+                                    <includes>**/*.java</includes>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.camel</groupId>
+                                    <artifactId>camel-core-engine</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>jar</type>
+                                    <classifier>sources</classifier>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>target/sources/camel-core-engine</outputDirectory>
+                                    <includes>**/*.java</includes>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.camel</groupId>
+                                    <artifactId>camel-core-xml</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>jar</type>
+                                    <classifier>sources</classifier>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>target/sources/camel-core-xml</outputDirectory>
+                                    <includes>**/*.java</includes>
+                                </artifactItem>
+                                <artifactItem>
+                                    <groupId>org.apache.camel</groupId>
+                                    <artifactId>camel-util</artifactId>
+                                    <version>${project.version}</version>
+                                    <type>jar</type>
+                                    <classifier>sources</classifier>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>target/sources/camel-util</outputDirectory>
+                                    <includes>**/*.java</includes>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-antrun-plugin</artifactId>
@@ -403,11 +453,11 @@
                                         <include name="org/apache/camel/spring/package-info.java" />
                                         <include name="org/apache/camel/util/spring/**/*.java" />
                                     </fileset>
-                                    <fileset dir="${basedir}/../../core/camel-core-xml/src/main/java">
+                                    <fileset dir="${project.build.directory}/sources/camel-core-xml">
                                         <include name="org/apache/camel/core/xml/*.java" />
                                         <include name="org/apache/camel/core/xml/util/**/*.java" />
                                     </fileset>
-                                    <fileset dir="${basedir}/../../core/camel-api/src/main/java">
+                                    <fileset dir="${project.build.directory}/sources/camel-api">
                                         <include name="org/apache/camel/ExchangePattern.java" />
                                         <include name="org/apache/camel/LoggingLevel.java" />
                                         <include name="org/apache/camel/ManagementStatisticsLevel.java" />
@@ -415,11 +465,11 @@
                                         <include name="org/apache/camel/ShutdownRunningTask.java" />
                                         <include name="org/apache/camel/WaitForTaskToComplete.java" />
                                     </fileset>
-                                    <fileset dir="${basedir}/../../core/camel-core-engine/src/main/java">
+                                    <fileset dir="${project.build.directory}/sources/camel-core-engine">
                                         <include name="org/apache/camel/model/**/*.java" />
                                         <include name="org/apache/camel/package-info.java" />
                                     </fileset>
-                                    <fileset dir="${basedir}/../../core/camel-util/src/main/java">
+                                    <fileset dir="${project.build.directory}/sources/camel-util">
                                         <include name="org/apache/camel/concurrent/ThreadPoolRejectedPolicy.java" />
                                     </fileset>
                                 </copy>
diff --git a/core/pom.xml b/core/pom.xml
index c517dca..64e2686 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -90,6 +90,21 @@
                     </execution>
                 </executions>
             </plugin>
+            <!-- generate sources JAR by default as they are needed by other Camel sub projects -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>3.2.1</version>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>jar-no-fork</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>build-helper-maven-plugin</artifactId>