[英]How to update the content of an existing yaml file with Pipeline Utility Steps plugin
[英]How to keep the comments and formatting of pom file intact while using pipeline-utility-steps
我正在使用管道實用程序步驟來更改管道腳本中的POM文件。 它工作正常並產生所需的結果。 但它刪除了我在POM文件中添加的所有注釋。 有誰知道如何解決它?
我只是使用:
writeMavenPom model: pom
提前致謝!
此問題已報告但目前尚未解決:
https://issues.jenkins-ci.org/browse/JENKINS-41902
您可以使用此帖子中的另一個XML庫來解析XML
https://stackoverflow.com/a/20720694/6612625
建議您使用像com.google.code.maven-replacer-plugin這樣的maven插件,請參閱
https://stackoverflow.com/a/37607214/6612625
我采用后一種方法,效果很好。 它適用於XPath,因此您可以解決POM中的任何元素或屬性。 它會在默認情況下保留您的評論。
要概述我推薦的語法:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.