This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch xmlio in repository https://gitbox.apache.org/repos/asf/camel.git
commit 5c0c44d592fcfb76f5c84221e09abb6d51cedfdf Author: Claus Ibsen <[email protected]> AuthorDate: Wed May 14 11:08:51 2025 +0200 CAMEL-22064: camel-xml-io - Generate XSD schema --- core/camel-xml-io/pom.xml | 110 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) diff --git a/core/camel-xml-io/pom.xml b/core/camel-xml-io/pom.xml index e675b14d46c..6f0543f0061 100644 --- a/core/camel-xml-io/pom.xml +++ b/core/camel-xml-io/pom.xml @@ -94,6 +94,116 @@ </execution> </executions> </plugin> + + <!-- generate XSD --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <id>store-camel-schema-version-in-file</id> + <phase>initialize</phase> + <configuration> + <target> + <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" /> + <property name="ant.regexp.regexpimpl" value="org.apache.tools.ant.util.regexp.Jdk14RegexpRegexp" /> + <property name="mv" value="${project.version}" /> + <propertyregex property="ov.p1" input="${mv}" regexp="(\d+)(?:\.(\d+)(?:\.(\d+))?)?(?:[^a-zA-Z0-9](.*))?" replace="\1" defaultValue="0" /> + <propertyregex property="ov.p2" input="${mv}" regexp="(\d+)(?:\.(\d+)(?:\.(\d+))?)?(?:[^a-zA-Z0-9](.*))?" replace=".\2" defaultValue=".0" /> + <propertyregex property="ov.p1a" input="${ov.p1}" regexp="(.+)" replace="\1" defaultValue="0" /> + <propertyregex property="ov.p2a" input="${ov.p2}" regexp="(\..+)" replace="\1" defaultValue=".0" /> + <property name="camel.schema.version" value="${ov.p1a}${ov.p2a}" /> + <mkdir dir="target" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + <execution> + <id>generate-sources</id> + <phase>process-classes</phase> + <configuration> + <target> + <echo>Copying code together for the XSD generation</echo> + <mkdir dir="${project.build.directory}/schema-src" /> + <copy todir="${project.build.directory}/schema-src"> + <fileset dir="${project.basedir}/../camel-core-xml/src/main/java"> + <include name="org/apache/camel/core/xml/*.java" /> + <include name="org/apache/camel/core/xml/util/**/*.java" /> + </fileset> + <fileset dir="${project.basedir}/../camel-api/src/main/java"> + <include name="org/apache/camel/BeanScope.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/StartupSummaryLevel.java" /> + <include name="org/apache/camel/TypeConverterExists.java" /> + <include name="org/apache/camel/WaitForTaskToComplete.java" /> + </fileset> + <fileset dir="${project.basedir}/../camel-core-model/src/main/java"> + <include name="org/apache/camel/model/**/*.java" /> + <include name="org/apache/camel/package-info.java" /> + </fileset> + <fileset dir="${project.basedir}/../camel-util/src/main/java"> + <include name="org/apache/camel/concurrent/ThreadPoolRejectedPolicy.java" /> + </fileset> + </copy> + </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> + <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-xml-io.xsd" preservelastmodified="true" /> + <copy file="${project.build.directory}/classes/camel-spring.xsd" tofile="${project.build.directory}/schema/camel-xml-io-v${camel.schema.version}.xsd" preservelastmodified="true" /> + <replace file="${project.build.directory}/schema/camel-xml-io-v${camel.schema.version}.xsd" token=""http://camel.apache.org/schema/spring"" value=""http://camel.apache.org/schema/xml-io/v${camel.schema.version}"" preservelastmodified="true" /> + <!-- copy modified schemas back again in classes so they are included in the JAR --> + <copy todir="${project.build.directory}/classes" preservelastmodified="true"> + <fileset dir="${project.build.directory}/schema"> + <exclude name="**/*.class" /> + </fileset> + </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> + <!-- 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/schema1.xsd</inputCamelSchemaFile> + <outputCamelSchemaFile>${project.build.directory}/classes/camel-xml-io.xsd + </outputCamelSchemaFile> + <deleteFilesAfterRun> + ${project.build.directory}/schema/schema1.xsd,${project.build.directory}/schema/schema2.xsd + </deleteFilesAfterRun> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build>
