Want to print version after maven build in jenkins in public folder for react app

I have a react app for which the jar file is created using pom.xml in jenkins.
The jar file name is something like - appname-1.0.0-20220728.062644-65.jar From above example, i am providing 1.0.0-SNAPSHOT as version in pom.xml file,the snapshot value is being generated from other scripts which is not in my control
Now the requirement is ,after the java file is created like with above jar filename, i need to output the version - 1.0.0-20220728.062644-65 in an object file under public folder like {"version":"1.0.0-20220728.062644-65"}

I have tried initially echoing using ant plugin in pom.xml to check whether i am able to get the complete version, but i just get 1.0.0-SNAPSHOT echoed,but i need the complete version along with snapshot value and needs to be printed as object in different file before pushing the file to deployment.

Any idea how to proceed