Shell command to update pom file from a variable

后端 未结 6 1466
[愿得一人]
[愿得一人] 2021-01-06 17:24

Previously I used below command to take the version in pom.xml and increment it from one. Before increment snapshot version is, 0.0.1

#!/bin/bas         


        
6条回答
  •  失恋的感觉
    2021-01-06 18:06

    Looks like you want to edit the pom.xml in the backend. Try the Perl one-liner. Check this out.

    > cat pom.xml
    
    
    
    4.0.0
    com.mss.inven
    INVEN
    0.0.1-SNAPSHOT
    
    > perl -ne ' { s/(.*)\.(\d+)(-SNAPSHOT.*)/printf("%s.%d%s",$1,$2+1,$3)/ge and $_=~s/.$//g if //; print } ' pom.xml
    
    
    
    4.0.0
    com.mss.inven
    INVEN
    0.0.2-SNAPSHOT
    
    >
    

提交回复
热议问题