| <?xml version="1.0" encoding="UTF-8"?> | |
| <!-- | |
| Licensed to the Apache Software Foundation (ASF) under one | |
| or more contributor license agreements. See the NOTICE file | |
| distributed with this work for additional information | |
| regarding copyright ownership. The ASF licenses this file | |
| to you under the Apache License, Version 2.0 (the | |
| "License"); you may not use this file except in compliance | |
| with the License. You may obtain a copy of the License at | |
| http://www.apache.org/licenses/LICENSE-2.0 | |
| Unless required by applicable law or agreed to in writing, | |
| software distributed under the License is distributed on an | |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| KIND, either express or implied. See the License for the | |
| specific language governing permissions and 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"> | |
| <parent> | |
| <groupId>org.apache.fory</groupId> | |
| <artifactId>fory-parent</artifactId> | |
| <version>2.0.0-SNAPSHOT</version> | |
| </parent> | |
| <modelVersion>4.0.0</modelVersion> | |
| <artifactId>fory-json</artifactId> | |
| <description> | |
| Apache Fory JSON serialization. | |
| </description> | |
| <properties> | |
| <maven.compiler.source>8</maven.compiler.source> | |
| <maven.compiler.target>8</maven.compiler.target> | |
| <maven.source.skip>false</maven.source.skip> | |
| <fory.java.rootdir>${basedir}/..</fory.java.rootdir> | |
| <fory.json.mr.classes>${project.build.directory}/multi-release-classes</fory.json.mr.classes> | |
| <fory.json.java9.test.classes>${project.build.directory}/java9-test-classes</fory.json.java9.test.classes> | |
| <fory.json.jdk25.test.classes>${project.build.directory}/jdk25-test-classes</fory.json.jdk25.test.classes> | |
| <fory.core.jdk25.test.classes>${project.basedir}/../fory-core/target/jdk25-test-classes</fory.core.jdk25.test.classes> | |
| </properties> | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.apache.fory</groupId> | |
| <artifactId>fory-core</artifactId> | |
| <version>${project.version}</version> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.apache.fory</groupId> | |
| <artifactId>fory-test-core</artifactId> | |
| <version>${project.version}</version> | |
| <scope>test</scope> | |
| </dependency> | |
| <dependency> | |
| <groupId>com.google.guava</groupId> | |
| <artifactId>guava</artifactId> | |
| <optional>true</optional> | |
| </dependency> | |
| <dependency> | |
| <groupId>com.google.code.findbugs</groupId> | |
| <artifactId>jsr305</artifactId> | |
| <scope>provided</scope> | |
| </dependency> | |
| </dependencies> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-jar-plugin</artifactId> | |
| <configuration> | |
| <excludes><exclude>META-INF/versions/**/*.java</exclude></excludes> | |
| <archive> | |
| <manifestEntries> | |
| <Automatic-Module-Name>org.apache.fory.json</Automatic-Module-Name> | |
| <Multi-Release>true</Multi-Release> | |
| </manifestEntries> | |
| </archive> | |
| </configuration> | |
| </plugin> | |
| </plugins> | |
| </build> | |
| <profiles> | |
| <profile> | |
| <id>jpms-java9</id> | |
| <activation> | |
| <jdk>[9,)</jdk> | |
| </activation> | |
| <dependencies> | |
| <dependency> | |
| <groupId>org.graalvm.sdk</groupId> | |
| <artifactId>graal-sdk</artifactId> | |
| <version>23.1.0</version> | |
| <scope>provided</scope> | |
| </dependency> | |
| <dependency> | |
| <groupId>org.graalvm.sdk</groupId> | |
| <artifactId>nativeimage</artifactId> | |
| <version>23.1.0</version> | |
| <scope>provided</scope> | |
| </dependency> | |
| </dependencies> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-antrun-plugin</artifactId> | |
| <version>3.1.0</version> | |
| <executions> | |
| <execution> | |
| <id>compile-java9-classes</id> | |
| <phase>process-classes</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <delete dir="${fory.json.mr.classes}/9"/> | |
| <mkdir dir="${fory.json.mr.classes}/9"/> | |
| <condition | |
| property="fory.core.module.jar" | |
| value="${project.basedir}/../fory-core/target/fory-core-${project.version}.jar" | |
| else="${settings.localRepository}/org/apache/fory/fory-core/${project.version}/fory-core-${project.version}.jar"> | |
| <available | |
| file="${project.basedir}/../fory-core/target/fory-core-${project.version}.jar"/> | |
| </condition> | |
| <path id="fory.core.compile.path"> | |
| <pathelement location="${project.basedir}/../fory-core/target/classes"/> | |
| <pathelement | |
| location="${settings.localRepository}/org/apache/fory/fory-core/${project.version}/fory-core-${project.version}.jar"/> | |
| </path> | |
| <path id="compile.module.path.elements"> | |
| <pathelement location="${fory.core.module.jar}"/> | |
| <difference> | |
| <path refid="maven.compile.classpath"/> | |
| <path refid="fory.core.compile.path"/> | |
| </difference> | |
| </path> | |
| <pathconvert property="compile.module.path" refid="compile.module.path.elements" | |
| pathsep="${path.separator}"/> | |
| <javac srcdir="${project.basedir}/src/main/java9" | |
| destdir="${fory.json.mr.classes}/9" | |
| includeantruntime="false" | |
| fork="true" | |
| executable="${java.home}/bin/javac" | |
| debug="true"> | |
| <include name="module-info.java"/> | |
| <include name="org/**/*.java"/> | |
| <compilerarg value="--release"/> | |
| <compilerarg value="9"/> | |
| <compilerarg value="--module-path"/> | |
| <compilerarg path="${compile.module.path}"/> | |
| <compilerarg value="--patch-module"/> | |
| <compilerarg value="org.apache.fory.json=${project.build.outputDirectory}"/> | |
| </javac> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>prepare-java9-classes</id> | |
| <phase>prepare-package</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <copy todir="${project.build.outputDirectory}/META-INF/versions/9"> | |
| <fileset dir="${fory.json.mr.classes}/9" includes="**/*.class"/> | |
| </copy> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>prepare-java9-test-classes</id> | |
| <phase>process-test-classes</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <delete dir="${fory.json.java9.test.classes}"/> | |
| <mkdir dir="${fory.json.java9.test.classes}"/> | |
| <copy todir="${fory.json.java9.test.classes}"> | |
| <fileset dir="${project.build.outputDirectory}"> | |
| <exclude name="module-info.class"/> | |
| </fileset> | |
| </copy> | |
| <copy todir="${fory.json.java9.test.classes}" overwrite="true"> | |
| <fileset dir="${fory.json.mr.classes}/9"> | |
| <exclude name="module-info.class"/> | |
| </fileset> | |
| </copy> | |
| <copy todir="${fory.json.java9.test.classes}" overwrite="true"> | |
| <fileset dir="${fory.json.mr.classes}/17" erroronmissingdir="false"/> | |
| </copy> | |
| </target> | |
| </configuration> | |
| </execution> | |
| </executions> | |
| </plugin> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-surefire-plugin</artifactId> | |
| <configuration> | |
| <classesDirectory>${fory.json.java9.test.classes}</classesDirectory> | |
| </configuration> | |
| </plugin> | |
| </plugins> | |
| </build> | |
| </profile> | |
| <profile> | |
| <id>graalvm-feature-java17</id> | |
| <activation> | |
| <jdk>[17,)</jdk> | |
| </activation> | |
| <build> | |
| <resources> | |
| <resource><directory>src/main/resources</directory></resource> | |
| <resource> | |
| <directory>src/main/java9</directory> | |
| <targetPath>META-INF/versions/9</targetPath> | |
| <includes><include>**/*.java</include></includes> | |
| </resource> | |
| <resource> | |
| <directory>src/main/java17</directory> | |
| <targetPath>META-INF/versions/17</targetPath> | |
| <includes><include>**/*.java</include></includes> | |
| </resource> | |
| <resource> | |
| <directory>src/main/java18</directory> | |
| <targetPath>META-INF/versions/18</targetPath> | |
| <includes><include>**/*.java</include></includes> | |
| </resource> | |
| <resource> | |
| <directory>src/main/java25</directory> | |
| <targetPath>META-INF/versions/25</targetPath> | |
| <includes><include>**/*.java</include></includes> | |
| </resource> | |
| </resources> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-source-plugin</artifactId> | |
| <executions> | |
| <execution> | |
| <id>attach-sources</id> | |
| <phase>package</phase> | |
| <goals> | |
| <goal>jar-no-fork</goal> | |
| </goals> | |
| </execution> | |
| </executions> | |
| </plugin> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-antrun-plugin</artifactId> | |
| <version>3.1.0</version> | |
| <executions> | |
| <execution> | |
| <id>compile-java17-feature</id> | |
| <phase>process-classes</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <delete dir="${fory.json.mr.classes}/17"/> | |
| <mkdir dir="${fory.json.mr.classes}/17"/> | |
| <javac srcdir="${project.basedir}/src/main/java17" | |
| destdir="${fory.json.mr.classes}/17" | |
| includeantruntime="false" | |
| fork="true" | |
| executable="${java.home}/bin/javac" | |
| debug="true"> | |
| <include name="org/**/*.java"/> | |
| <classpath> | |
| <path refid="maven.compile.classpath"/> | |
| <pathelement location="${project.build.outputDirectory}"/> | |
| </classpath> | |
| <compilerarg value="--release"/> | |
| <compilerarg value="17"/> | |
| <!-- Keep the empty value in one argument: javac ignores blank lines in Ant argfiles. --> | |
| <compilerarg value="--source-path="/> | |
| </javac> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>compile-java17-tests</id> | |
| <phase>test-compile</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <skip>${maven.test.skip}</skip> | |
| <target> | |
| <javac srcdir="${project.basedir}/src/test/java17" | |
| destdir="${project.build.testOutputDirectory}" | |
| includeantruntime="false" | |
| fork="true" | |
| executable="${java.home}/bin/javac" | |
| debug="true"> | |
| <include name="org/**/*.java"/> | |
| <classpath> | |
| <path refid="maven.test.classpath"/> | |
| <pathelement location="${project.build.outputDirectory}"/> | |
| <pathelement location="${fory.json.mr.classes}/17"/> | |
| </classpath> | |
| <compilerarg value="--release"/> | |
| <compilerarg value="17"/> | |
| <compilerarg value="--source-path="/> | |
| <!-- The checked-in subtype table simulates processor output. --> | |
| <compilerarg value="-proc:none"/> | |
| </javac> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>prepare-java17-feature</id> | |
| <phase>prepare-package</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <copy todir="${project.build.outputDirectory}/META-INF/versions/17"> | |
| <fileset dir="${fory.json.mr.classes}/17" includes="**/*.class"/> | |
| </copy> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>verify-graalvm-feature-jar</id> | |
| <phase>verify</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <skip>${maven.source.skip}</skip> | |
| <target> | |
| <java | |
| classname="org.apache.fory.json.ForyJsonGraalVMFeatureJarVerifier" | |
| fork="true" | |
| failonerror="true"> | |
| <classpath> | |
| <pathelement location="${project.build.testOutputDirectory}"/> | |
| <path refid="maven.test.classpath"/> | |
| </classpath> | |
| <arg value="${project.build.directory}/${project.build.finalName}.jar"/> | |
| <arg value="${project.build.directory}/${project.build.finalName}-sources.jar"/> | |
| </java> | |
| </target> | |
| </configuration> | |
| </execution> | |
| </executions> | |
| </plugin> | |
| </plugins> | |
| </build> | |
| </profile> | |
| <profile> | |
| <id>jdk18-multi-release</id> | |
| <activation> | |
| <jdk>[18,)</jdk> | |
| </activation> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-antrun-plugin</artifactId> | |
| <version>3.1.0</version> | |
| <executions> | |
| <execution> | |
| <id>compile-jdk18-classes</id> | |
| <phase>process-classes</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <delete dir="${fory.json.mr.classes}/18"/> | |
| <mkdir dir="${fory.json.mr.classes}/18"/> | |
| <javac srcdir="${project.basedir}/src/main/java18" | |
| destdir="${fory.json.mr.classes}/18" | |
| includeantruntime="false" | |
| fork="true" | |
| executable="${java.home}/bin/javac" | |
| debug="true"> | |
| <include name="org/**/*.java"/> | |
| <classpath> | |
| <path refid="maven.compile.classpath"/> | |
| <pathelement location="${project.build.outputDirectory}"/> | |
| </classpath> | |
| <compilerarg value="--release"/> | |
| <compilerarg value="18"/> | |
| <compilerarg value="--source-path="/> | |
| </javac> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>prepare-jdk18-classes</id> | |
| <phase>prepare-package</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <copy todir="${project.build.outputDirectory}/META-INF/versions/18"> | |
| <fileset dir="${fory.json.mr.classes}/18" includes="**/*.class"/> | |
| </copy> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>prepare-jdk18-test-classes</id> | |
| <phase>process-test-classes</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <copy todir="${fory.json.java9.test.classes}" overwrite="true"> | |
| <fileset dir="${fory.json.mr.classes}/18"/> | |
| </copy> | |
| </target> | |
| </configuration> | |
| </execution> | |
| </executions> | |
| </plugin> | |
| </plugins> | |
| </build> | |
| </profile> | |
| <profile> | |
| <id>jdk25-multi-release</id> | |
| <activation> | |
| <jdk>[25,)</jdk> | |
| </activation> | |
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-antrun-plugin</artifactId> | |
| <version>3.1.0</version> | |
| <executions> | |
| <execution> | |
| <id>compile-jdk25-classes</id> | |
| <phase>process-classes</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <delete dir="${fory.json.mr.classes}/25"/> | |
| <mkdir dir="${fory.json.mr.classes}/25"/> | |
| <javac srcdir="${project.basedir}/src/main/java25" | |
| destdir="${fory.json.mr.classes}/25" | |
| includeantruntime="false" | |
| fork="true" | |
| executable="${java.home}/bin/javac" | |
| debug="true"> | |
| <include name="org/**/*.java"/> | |
| <classpath> | |
| <path refid="maven.compile.classpath"/> | |
| <pathelement location="${project.build.outputDirectory}"/> | |
| </classpath> | |
| <compilerarg value="--release"/> | |
| <compilerarg value="22"/> | |
| <compilerarg value="--source-path="/> | |
| </javac> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>prepare-jdk25-classes</id> | |
| <phase>prepare-package</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <copy todir="${project.build.outputDirectory}/META-INF/versions/25"> | |
| <fileset dir="${fory.json.mr.classes}/25" includes="**/*.class"/> | |
| </copy> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>prepare-jdk25-test-classes</id> | |
| <phase>process-test-classes</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <delete dir="${fory.json.jdk25.test.classes}"/> | |
| <mkdir dir="${fory.json.jdk25.test.classes}"/> | |
| <!-- Reactor tests see dependency target/classes instead of the packaged | |
| multi-release jar. Put Fory core's JDK25 test overlay ahead of the raw | |
| dependency classes so JsonCodegen exercises the same CodecBuilder owner | |
| path as packaged JDK25 runs. --> | |
| <copy todir="${fory.json.jdk25.test.classes}"> | |
| <fileset dir="${project.build.outputDirectory}"> | |
| <exclude name="module-info.class"/> | |
| </fileset> | |
| </copy> | |
| <copy todir="${fory.json.jdk25.test.classes}" overwrite="true"> | |
| <fileset dir="${fory.json.mr.classes}/9"> | |
| <exclude name="module-info.class"/> | |
| </fileset> | |
| </copy> | |
| <copy todir="${fory.json.jdk25.test.classes}" overwrite="true"> | |
| <fileset dir="${fory.json.mr.classes}/17" erroronmissingdir="false"/> | |
| </copy> | |
| <copy todir="${fory.json.jdk25.test.classes}" overwrite="true"> | |
| <fileset dir="${fory.json.mr.classes}/18"/> | |
| </copy> | |
| <copy todir="${fory.json.jdk25.test.classes}" overwrite="true"> | |
| <fileset dir="${fory.json.mr.classes}/25"> | |
| <exclude name="module-info.class"/> | |
| </fileset> | |
| </copy> | |
| <copy todir="${fory.json.jdk25.test.classes}" overwrite="true"> | |
| <fileset dir="${fory.core.jdk25.test.classes}" erroronmissingdir="false"> | |
| <exclude name="module-info.class"/> | |
| </fileset> | |
| </copy> | |
| </target> | |
| </configuration> | |
| </execution> | |
| <execution> | |
| <id>verify-jdk25-multi-release-jar</id> | |
| <phase>verify</phase> | |
| <goals> | |
| <goal>run</goal> | |
| </goals> | |
| <configuration> | |
| <target> | |
| <condition | |
| property="fory.core.module.jar" | |
| value="${project.basedir}/../fory-core/target/fory-core-${project.version}.jar" | |
| else="${settings.localRepository}/org/apache/fory/fory-core/${project.version}/fory-core-${project.version}.jar"> | |
| <available | |
| file="${project.basedir}/../fory-core/target/fory-core-${project.version}.jar"/> | |
| </condition> | |
| <java | |
| classname="org.apache.fory.json.writer.Jdk25MultiReleaseJarVerifier" | |
| fork="true" | |
| failonerror="true"> | |
| <classpath> | |
| <pathelement location="${project.build.testOutputDirectory}"/> | |
| <path refid="maven.test.classpath"/> | |
| </classpath> | |
| <arg value="${project.build.directory}/${project.build.finalName}.jar"/> | |
| <arg value="${project.build.directory}/${project.build.finalName}-sources.jar"/> | |
| <arg value="${fory.core.module.jar}"/> | |
| </java> | |
| </target> | |
| </configuration> | |
| </execution> | |
| </executions> | |
| </plugin> | |
| <plugin> | |
| <groupId>org.apache.maven.plugins</groupId> | |
| <artifactId>maven-surefire-plugin</artifactId> | |
| <configuration> | |
| <argLine>${argLine} --add-opens=java.base/java.lang.invoke=ALL-UNNAMED</argLine> | |
| <classesDirectory>${fory.json.jdk25.test.classes}</classesDirectory> | |
| </configuration> | |
| </plugin> | |
| </plugins> | |
| </build> | |
| </profile> | |
| </profiles> | |
| </project> |