尝试 powershell 脚本
using assembly System.Xml.Linq
$input_filename = 'c:\temp\test.xml'
$output_filename = 'c:\temp\test1.xml'
$doc = [System.Xml.Linq.XDocument]::Load($input_filename)
$files = $doc.Descendants('Files')
$foos = [System.Linq.Enumerable]::Where($files, [Func[object,bool]]{ param($x) [string]$x.Value.StartsWith('public/foo')})
$pattern = '(public/foo-)(.*)(.jar)'
$newVersion = '1.2.1'
foreach($foo in $foos)
{
$version = $foo[0].Value
$newValue = $version -replace $pattern, '$1xyz$3'
$newValue = $newValue -replace 'xyz', "$newVersion"
$foo.FirstNode.SetValue($newValue)
}
$doc.Save($output_filename)