package cn.zno.version; import java.io.File; import java.nio.charset.Charset; import cn.zno.ambi.bas.util.FileUtils; import cn.zno.ambi.bas.xml.XmlUtils; public class Main { public static void main(String[] args) { if (args.length == 0) { System.out.println("Please set version num"); return; } System.out.println("新版本号:" + args[0]); String property = System.getProperty("user.dir"); System.out.println("当前目录:" + property); File folder = new File(property); File[] search = FileUtils.search("pom\\.xml", folder); for (File file : search) { String qualified = FileUtils.qualified(file); System.out.println("next:" + qualified); String xxxx = XmlUtils.getElementText(file, Charset.forName("utf-8"), "project.version"); if (!(xxxx == null) && !xxxx.equals(args[0])) { System.out.println("【project.version】【"+xxxx+"】---->【"+args[0]+"】"); XmlUtils.setElementText(file, Charset.forName("utf-8"), "project.version", args[0]); } String yyyy = XmlUtils.getElementText(file, Charset.forName("utf-8"), "project.parent.version"); if (!(yyyy == null)&& !yyyy.equals(args[0])) { System.out.println("【project.parent.version】【"+yyyy+"】---->【"+args[0]+"】"); XmlUtils.setElementText(file, Charset.forName("utf-8"), "project.parent.version", args[0]); } } } }
标签:version,版本号,args,一键,System,project,pom,file,out From: https://www.cnblogs.com/zno2/p/10525128.html