You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
We have encountered some format issues when using this library to update our dependencies in pom. We leverage the library to upgrade dependencies automatically.
Here is the usecase. First get pomModel and SAXBuilder doc from pom file, then calculate the pomModel we need based on some rules(will adding or removing some dependency in pomModel), update SAXBuilder doc with the pomModel, then write doc back to pom file. new MavenJDOMWriter().setExpandEmptyElements(true).write(module.pomModel, doc, outWriter, format)
The format issue may cause thousands of different lines in an enterprise level project, and most of them are just caused by format difference. It costs a lot of extra efforts to let us locate which really changes.
So I have made some changes to enhance the result. Do you have any plan to make enhancement for below cases?
hard code indent: I notice that the indent is hard code in WriterUtils as two whitespace which make new added dependencies with incorrect format as below.(The indent in below sample is '\t')
In some cases, the target element to update in iterateDependency will lead format issues. As below picture, we removed dep B in pomModel and when it updates dep C back to SAX document, it will update the content to the second element(dep B), and there is no exclusions there. So, all the extension elements will be created and element in it will follow default order. The default means artifactId is the first element in extension, and groupId is the second one. If the element order in pom file is different, there will be different lines. Meanwhile, since the constant indent in first case, the new added extension elements is most likely with the different indent and caused different lines.
Hi,
We have encountered some format issues when using this library to update our dependencies in pom. We leverage the library to upgrade dependencies automatically.
Here is the usecase. First get pomModel and SAXBuilder doc from pom file, then calculate the pomModel we need based on some rules(will adding or removing some dependency in pomModel), update SAXBuilder doc with the pomModel, then write doc back to pom file.
new MavenJDOMWriter().setExpandEmptyElements(true).write(module.pomModel, doc, outWriter, format)
The format issue may cause thousands of different lines in an enterprise level project, and most of them are just caused by format difference. It costs a lot of extra efforts to let us locate which really changes.
So I have made some changes to enhance the result. Do you have any plan to make enhancement for below cases?
Sample pom (The indent in below sample is '\t')
After remove dependency maven-model
The text was updated successfully, but these errors were encountered: