Repository: camel Updated Branches: refs/heads/master ddf98531f -> 82264a3b6
CAMEL-10141: make camel-spring tests pass on Java 9. This required the use of Java's native shemagen instead of jaxb-xjc's embedded schemagen which doesn't work on Java 9 Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/82264a3b Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/82264a3b Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/82264a3b Branch: refs/heads/master Commit: 82264a3b60147bb3fdf92275929ffc34346b5927 Parents: 53e70d36 Author: jpoth <poth.j...@gmail.com> Authored: Fri Apr 21 14:51:10 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Fri Apr 21 15:03:44 2017 +0200 ---------------------------------------------------------------------- components/camel-spring/pom.xml | 162 ++++++++++++++++++++++++++++------- 1 file changed, 132 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/82264a3b/components/camel-spring/pom.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml index e44e5bf..afa10f7 100644 --- a/components/camel-spring/pom.xml +++ b/components/camel-spring/pom.xml @@ -305,7 +305,6 @@ <phase>process-classes</phase> <configuration> <target> - <taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask" classpathref="maven.plugin.classpath" /> <echo>Copying code together for the XSD generation</echo> <mkdir dir="${project.build.directory}/schema-src" /> <copy todir="${project.build.directory}/schema-src"> @@ -331,15 +330,6 @@ <include name="org/apache/camel/package-info.java" /> </fileset> </copy> - <echo>Generating XSD schema</echo> - <mkdir dir="${project.build.directory}/schema" /> - <schemagen srcdir="${project.build.directory}/schema-src" destdir="${project.build.directory}/schema"> - <schema namespace="http://camel.apache.org/schema/spring" file="camel-spring.xsd" /> - <compilerarg line="-target ${jdk.version}"/> - <compilerarg line="-source ${jdk.version}"/> - <classpath refid="maven.compile.classpath" /> - </schemagen> - </target> </configuration> <goals> @@ -568,31 +558,143 @@ </profile> <profile> + <id>jdk8</id> + <activation> + <jdk>(,1.8]</jdk> + </activation> + <dependencies> + <!-- xmltokenizer using woodstox --> + <dependency> + <groupId>org.codehaus.woodstox</groupId> + <artifactId>woodstox-core-asl</artifactId> + <version>${woodstox-version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <id>generate-schema</id> + <phase>process-classes</phase> + <configuration> + <target> + <echo>Generating XSD schema</echo> + <taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask" classpathref="maven.plugin.classpath" /> + <mkdir dir="${project.build.directory}/schema" /> + <schemagen srcdir="${project.build.directory}/schema-src" destdir="${project.build.directory}/schema"> + <schema namespace="http://camel.apache.org/schema/spring" file="camel-spring.xsd" /> + <compilerarg line="-target ${jdk.version}"/> + <compilerarg line="-source ${jdk.version}"/> + <classpath refid="maven.compile.classpath" /> + </schemagen> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + + <profile> <id>jdk9-build</id> <activation> <jdk>9</jdk> </activation> + <dependencies> + <!-- xmltokenizer using woodstox --> + <dependency> + <groupId>org.codehaus.woodstox</groupId> + <artifactId>woodstox-core-asl</artifactId> + <version>${woodstox-version}</version> + <scope>test</scope> + </dependency> + </dependencies> <build> - <pluginManagement> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-antrun-plugin</artifactId> - <dependencies> - <dependency> - <groupId>javax.xml.bind</groupId> - <artifactId>jaxb-api</artifactId> - <version>${jaxb-version}</version> - </dependency> - <dependency> - <groupId>javax.activation</groupId> - <artifactId>activation</artifactId> - <version>1.1.1</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </pluginManagement> + <plugins> + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <argLine>--add-modules java.xml.bind,java.xml.ws --add-opens java.base/java.lang=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2=ALL-UNNAMED --add-exports=java.xml.bind/com.sun.xml.internal.bind.v2.runtime.reflect=ALL-UNNAMED</argLine> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <id>list-source-files-for-schema-generation</id> + <phase>process-classes</phase> + <configuration> + <target> + <taskdef resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" /> + <path id ="source.files.list"> + <fileset dir="${project.build.directory}/schema-src"> + <include name="**/*.java" /> + </fileset> + </path> + <property name="source.files.property" refid="source.files.list"/> + <propertyregex property="schema.source.formatted" input="${source.files.property}" regexp=":" replace=" " global="true" /> + <property name="schema.source.files" value="${schema.source.formatted}"/> + <echo>Schema files ${schema.source.files}</echo> + </target> + <exportAntProperties>true</exportAntProperties> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate schema</id> + <phase>generate-test-sources</phase> + <goals> + <goal>exec</goal> + </goals> + </execution> + </executions> + <configuration> + <executable>schemagen</executable> + <commandlineArgs>-cp %classpath ${schema.source.files}</commandlineArgs> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <version>1.8</version> + <executions> + <execution> + <id>cpy-schema</id> + <phase>generate-test-sources</phase> + <configuration> + <target> + <echo>Copying XSD schema to be included in JAR</echo> + <move file="${project.basedir}/schema1.xsd" tofile="${project.build.directory}/schema/camel-spring.xsd" /> + <delete file="${project.basedir}/schema2.xsd"/> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> </build> </profile> </profiles>