diff --git a/0005-upgrade-os-maven-plugin-to-1.7.1.patch b/0005-upgrade-os-maven-plugin-to-1.7.1.patch
new file mode 100644
index 0000000000000000000000000000000000000000..9e17cd0f5b551e3b3174471f9f9375af33da1d71
--- /dev/null
+++ b/0005-upgrade-os-maven-plugin-to-1.7.1.patch
@@ -0,0 +1,13 @@
+diff --git a/flink-formats/flink-parquet/pom.xml b/flink-formats/flink-parquet/pom.xml
+index a95f6ce0..6085256d 100644
+--- a/flink-formats/flink-parquet/pom.xml
++++ b/flink-formats/flink-parquet/pom.xml
+@@ -251,7 +251,7 @@ under the License.
+
+ kr.motd.maven
+ os-maven-plugin
+- 1.7.0
++ 1.7.1
+
+
+
diff --git a/flink.spec b/flink.spec
index 5588b61e0c136d773f885aa41ba8fa69dc9faabb..cd7bbb86290fd2167f9fa6f534ecce8bd4880366 100644
--- a/flink.spec
+++ b/flink.spec
@@ -11,7 +11,7 @@
Name: flink
Version: 1.17.1
-Release: 2
+Release: 3
Summary: Stateful Computations over Data Streams
License: Apache License v2.0
URL: https://github.com/apache/%{name}
@@ -21,11 +21,15 @@ Source3: https://packages.confluent.io/maven/io/confluent/kafka-avro-seri
Source4: https://packages.confluent.io/maven/io/confluent/kafka-schema-serializer/7.2.2/kafka-schema-serializer-7.2.2.jar
Source5: https://packages.confluent.io/maven/org/apache/kafka/kafka-clients/7.2.2-ccs/kafka-clients-7.2.2-ccs.jar
Source6: npm-8.1.2.tar.gz
+Source7: protoc-jar-3.11.4.tar.gz
+Source8: protoc-jar-maven-plugin-3.11.4.tar.gz
+Source9: protoc-3.21.7-linux-riscv64.exe
Patch0: 0001-add-npm.hw-repo.patch
Patch1: 0002-fix-compilation-failure.patch
-Patch2: 0003-Skip-flink-avro-confluent-registry-test.patch
-Patch3: 0004-update-npm.hw-repo.patch
+Patch2: 0003-Skip-flink-avro-confluent-registry-test.patch
+Patch3: 0004-update-npm.hw-repo.patch
+Patch4: 0005-upgrade-os-maven-plugin-to-1.7.1.patch
BuildRequires: java-1.8.0-openjdk-devel maven npm
Requires: java-1.8.0-openjdk
@@ -38,12 +42,25 @@ mvn install:install-file -DgroupId=io.confluent -DartifactId=kafka-schema-regist
mvn install:install-file -DgroupId=io.confluent -DartifactId=kafka-avro-serializer -Dversion=7.2.2 -Dpackaging=jar -Dfile=%{SOURCE3}
mvn install:install-file -DgroupId=io.confluent -DartifactId=kafka-schema-serializer -Dversion=7.2.2 -Dpackaging=jar -Dfile=%{SOURCE4}
mvn install:install-file -DgroupId=org.apache.kafka -DartifactId=kafka-clients -Dversion=7.2.2-ccs -Dpackaging=jar -Dfile=%{SOURCE5}
+%ifarch riscv64
+mkdir -p ${HOME}/.m2/repository/com/github/os72/protoc-jar/
+tar -mxf %{SOURCE7} -C ${HOME}/.m2/repository/com/github/os72/protoc-jar/
+mkdir -p ${HOME}/.m2/repository/com/github/os72/protoc-jar-maven-plugin/
+tar -mxf %{SOURCE8} -C ${HOME}/.m2/repository/com/github/os72/protoc-jar-maven-plugin/
+mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.21.7 -Dclassifier=linux-riscv64 -Dpackaging=exe -Dfile=%{SOURCE9}
+%endif
mkdir -p ${HOME}/.m2/repository/com/github/eirslett/npm/8.1.2/
cp %{SOURCE6} ${HOME}/.m2/repository/com/github/eirslett/npm/8.1.2/
%build
+%ifarch riscv64
+export MAVEN_OPTS="-Xms10240m -Xmx10240m -Xss2m -XX:MaxTenuringThreshold=0"
+export JAVA_TOOL_OPTIONS="-Xms10240m -Xmx10240m"
+mvn clean install -DskipTests -Dfast -T 2 -Pskip-webui-build
+%else
npm config set registry https://repo.huaweicloud.com/repository/npm/
mvn clean install -DskipTests -Dfast -T 2
+%endif
%install
mkdir -p %{buildroot}/opt/
@@ -57,6 +74,10 @@ find %{buildroot}/opt/apache-%{name}-%{version}/ -type f -name '*.py' | xargs -i
%license LICENSE
%changelog
+* Wed May 29 2024 Dingli Zhang - 1.17.1-3
+- Fix riscv64 support
+- Upgrade os-maven-plugin to 1.7.1
+
* Wed Apr 24 2024 shaojiansong - 1.17.1-2
- update npm download url for maven plugin
diff --git a/protoc-3.21.7-linux-riscv64.exe b/protoc-3.21.7-linux-riscv64.exe
new file mode 100644
index 0000000000000000000000000000000000000000..8c84f00cf00964942d0d77d552490fd370533430
Binary files /dev/null and b/protoc-3.21.7-linux-riscv64.exe differ
diff --git a/protoc-jar-3.11.4.tar.gz b/protoc-jar-3.11.4.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..8a159e31a155f784dc3bdff50d7b753c8529e284
Binary files /dev/null and b/protoc-jar-3.11.4.tar.gz differ
diff --git a/protoc-jar-maven-plugin-3.11.4.tar.gz b/protoc-jar-maven-plugin-3.11.4.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..b7f1af5fbeed5ce84a707fbe198bf9d41bb54f26
Binary files /dev/null and b/protoc-jar-maven-plugin-3.11.4.tar.gz differ