diff --git a/Others/fastjson/2.0.58/24.03-lts-sp1/Dockerfile b/Others/fastjson/2.0.58/24.03-lts-sp1/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..1b2d66f1541efbdf300833d113c6114f60641716 --- /dev/null +++ b/Others/fastjson/2.0.58/24.03-lts-sp1/Dockerfile @@ -0,0 +1,35 @@ +ARG BASE=openeuler/openeuler:24.03-lts-sp1 +FROM ${BASE} as BUILDER +ARG TARGETARCH +ARG BUILDARCH +ARG VERSION=2.0.58 +ARG JDK_VERSION=17.0.15_6 + +RUN dnf install -y maven gettext wget \ + && dnf clean all \ + && rm -rf /var/cache/dnf/* + +RUN if [ "$TARGETARCH" = "amd64" ]; then \ + BUILDARCH="x64"; \ + elif [ "$TARGETARCH" = "arm64" ]; then \ + BUILDARCH="aarch64"; \ + fi \ + && cd / \ + && wget https://mirrors.tuna.tsinghua.edu.cn/Adoptium/17/jdk/${BUILDARCH}/linux/OpenJDK17U-jdk_${BUILDARCH}_linux_hotspot_${JDK_VERSION}.tar.gz \ + && tar -zxvf OpenJDK17U-jdk_${BUILDARCH}_linux_hotspot_${JDK_VERSION}.tar.gz \ + && rm -f OpenJDK17U-jdk_${BUILDARCH}_linux_hotspot_${JDK_VERSION}.tar.gz + +ENV JAVA_HOME=/jdk-17.0.15+6 +ENV PATH=${JAVA_HOME}/bin:$PATH +ENV LANG="C.UTF-8" + +WORKDIR /home/fastjson +COPY Fastjson2Demo.java src/main/java/com/example/Fastjson2Demo.java +COPY pom.xml.template pom.xml.template + +ENV FAST_JSON_VERSION=${VERSION} + +RUN envsubst < pom.xml.template > pom.xml \ + && mvn clean compile -Dfile.encoding=UTF-8 + +CMD mvn exec:java -Dexec.mainClass="com.example.Fastjson2Demo" \ No newline at end of file diff --git a/Others/fastjson/2.0.58/24.03-lts-sp1/Fastjson2Demo.java b/Others/fastjson/2.0.58/24.03-lts-sp1/Fastjson2Demo.java new file mode 100644 index 0000000000000000000000000000000000000000..374a639cbafa9d06874476ca082df45c48029fad --- /dev/null +++ b/Others/fastjson/2.0.58/24.03-lts-sp1/Fastjson2Demo.java @@ -0,0 +1,25 @@ +package com.example; + +import com.alibaba.fastjson2.JSON; + +public class Fastjson2Demo { + static class User { + public String name; + public int age; + + public User() {} + public User(String name, int age) { + this.name = name; + this.age = age; + } + } + + public static void main(String[] args) { + User user = new User("张三", 25); + String jsonString = JSON.toJSONString(user); + System.out.println("序列化结果:" + jsonString); + + User parsed = JSON.parseObject(jsonString, User.class); + System.out.println("反序列化结果:" + parsed.name + ", " + parsed.age); + } +} diff --git a/Others/fastjson/2.0.58/24.03-lts-sp1/pom.xml.template b/Others/fastjson/2.0.58/24.03-lts-sp1/pom.xml.template new file mode 100644 index 0000000000000000000000000000000000000000..969fbd9c89fa0b92312d41772a3c7af2d8d10f3f --- /dev/null +++ b/Others/fastjson/2.0.58/24.03-lts-sp1/pom.xml.template @@ -0,0 +1,49 @@ + + + 4.0.0 + + com.example + fastjson2-demo + 1.0-SNAPSHOT + + + UTF-8 + 17 + 17 + + + + + com.alibaba.fastjson2 + fastjson2 + ${FAST_JSON_VERSION} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + ${maven.compiler.source} + ${maven.compiler.target} + + + + + org.codehaus.mojo + exec-maven-plugin + 3.1.0 + + com.example.Fastjson2Demo + + + + + + diff --git a/Others/fastjson/meta.yml b/Others/fastjson/meta.yml index e9be4f5bb4738a3dfdb58c500a7ceef5fc877bd9..37b7f5efe1f4aa387726e262f15573e1bf5a8745 100644 --- a/Others/fastjson/meta.yml +++ b/Others/fastjson/meta.yml @@ -1,2 +1,5 @@ 2.0.57-oe2403sp1: path: 2.0.57/24.03-lts-sp1/Dockerfile + +2.0.58-oe2403sp1: + path: 2.0.58/24.03-lts-sp1/Dockerfile \ No newline at end of file