将 xml 文件与 maven 或 ant 进行比较 [英] compare xml files with maven or ant

查看:28
本文介绍了将 xml 文件与 maven 或 ant 进行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要比较 wsdl 和 xsd 文件的 2 个目录使用 maven 或 ant 并生成报告(最好是 html)差异.

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.

有什么建议吗?

推荐答案

我会写你自己的插件.从命令行开始:

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

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

从列表中选择 maven 插件.将生成一个插件项目.

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

插件代码将有一个 execute() 方法,只需实现它.实现这个简单的方法比用 Ant 插件来破解要快得多、干净得多.例如,使用正常的进程执行语义,您可以运行两个目录树的递归差异.无论您在命令行中做什么.

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.

但如果是那么简单,只需运行命令行,请查看 http://mojo.codehaus.org/exec-maven-plugin/index.html 首先看看这是否能解决您的问题.请注意,此插件通常不能跨操作系统移植.出于这个原因,通常首选编写自己的插件.

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.

您可以将这个新的插件项目添加到您的源代码树中,Maven 会知道先构建插件.

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

这篇关于将 xml 文件与 maven 或 ant 进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆