compare xml files with maven or ant

牧云@^-^@ 提交于 2020-01-06 04:16:25

问题


I have a requirement to compare 2 directories of wsdl and xsd files using maven or ant and to generate a report (preferably html) of the differences.

Any recommendations?


回答1:


I would write your own Plugin. Start with this on the command line:

mvn archetype:generate -DgroupId=mygroup -DartifactId=myartifact

Choose maven plugin from the list. A plugin project will be generated.

The plugin code will have an execute() method, just implement that. It will be far faster and cleaner to implement this simple method than to hack around with the Ant plugin. For instance, using normal process exec semantics, you could run a recursive diff of the two directory trees. Whatever you would do from the command line.

But if it were that simple, to just run a command line, check out http://mojo.codehaus.org/exec-maven-plugin/index.html first to see if that will solve your problem. Note that this plugin is not generally portable across operating systems though. Writing your own plugin is generally preferred for this reason.

You can add this new plugin project to your source tree, Maven will know to build the plugin first.



来源:https://stackoverflow.com/questions/4617785/compare-xml-files-with-maven-or-ant

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!