alan2lin commented on PR #27976:
URL: https://github.com/apache/shardingsphere/pull/27976#issuecomment-1829656681

   
[JAXB_patch.zip](https://github.com/apache/shardingsphere/files/13486150/JAXB_patch.zip)
   
   share a bash script to  migrate from java EE 8 to Jakarta ,in springboot 
3.1.6 ,jdk 17+
   
   repodir=/data/gitrepo/shardingsphere/
   # search for all  file extensions 
   find ${repodir} -type f  -name "*.*" -exec bash -c 'ext="${1##*.}"; [ 
${#ext} -lt 5 ] && echo "$ext "' _ {} \; | sort -u > suffix.txt
   
   # find import javax.xml.bind.annotation.* 
   find ${repodir} -type f  \( -name "*.java" -o -name "*.md" -o -name "*.xml" 
-o -name "*.yaml" -o -name "*.yml" -o -name "*.txt" -o -name "*.toml" \) -exec 
bash -c 'sed -n  "s/import javax\(\.xml\.bind\.annotation\.[^;]\+;\)/import 
jakarta\1/p" "$1" | awk -v file="$1" -v OFS=, "{if (\$0 != \"\") print file, 
NR, \$0}"' _ {} \; > preview.txt
   
   
   # find import javax.xml.bind.JAXB*
    find ${repodir} -type f  \( -name "*.java" -o -name "*.md" -o -name "*.xml" 
-o -name "*.yaml" -o -name "*.yml" -o -name "*.txt" -o -name "*.toml" \) -exec 
bash -c 'sed -n  "s/import javax\(\.xml\.bind\.JAXB[^;]\+;\)/import 
jakarta\1/p" "$1" | awk -v file="$1" -v OFS=, "{if (\$0 != \"\") print file, 
NR, \$0}"' _ {} \; >> preview.txt
   
   # replace import javax.xml.bind.annotation.*  with import 
jakarta.xml.bind.annotation.*
    find ${repodir} -type f  \( -name "*.java" -o -name "*.md" -o -name "*.xml" 
-o -name "*.yaml" -o -name "*.yml" -o -name "*.txt" -o -name "*.toml" \) -exec 
bash -c 'sed -i  "s/import javax\(\.xml\.bind\.annotation\.[^;]\+;\)/import 
jakarta\1/g" "$1" ' _ {} \; 
   
   # replace import javax.xml.bind.JAXB*  with import jakarta.xml.bind.JAXB*
   find ${repodir} -type f  \( -name "*.java" -o -name "*.md" -o -name "*.xml" 
-o -name "*.yaml" -o -name "*.yml" -o -name "*.txt" -o -name "*.toml" \) -exec 
bash -c 'sed -i  "s/import javax\(\.xml\.bind\.JAXB[^;]\+;\)/import 
jakarta\1/g" "$1" ' _ {} \; 
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to