如何从 checkstyle.xml 转换为 Eclipse 代码样式格式/配置文件并再次转换回来?
我有 Eclipse 代码格式化程序和配置文件 xml 文档,我想构建一个 checkstyle.xml,我可以在我的 Maven 构建中使用它来运行报告并生成 Eclipse 文件。 maven-eclipse-plugin 似乎能够从 checkstyle.xml 生成 eclipse 文件(我认为),但我不知道如何走其他路,我不期待手工完成。
如果数据从 checkstyle 通过 maven 流动 -> eclipse 它应该以相反的方向流动。
有谁知道如何从 2 个 eclipse 文件生成 checkstyle.xml ?
I have eclipse code formatter and profile xml docs and I'd like to build a checkstyle.xml which I can use in my maven builds to run reports and generate the eclipse files. maven-eclipse-plugin appears to be able to generate the eclipse files from the checkstyle.xml (I think), but I'm not sure how to go the other way and I'm not looking forward to doing it by hand.
If data flows via maven from checkstyle -> eclipse it should flow in the reverse direction.
Does anyone know how to generate a checkstyle.xml from the 2 eclipse files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
并不是所有的数据转换都是双向的,因此并不一定因为您可以从 Checkstyle 转换到 Eclipse 就可以应用逆变换。
在这种情况下,我认为这更多是一种需求和具有单一规范配置源的情况。所有 Maven 构建都需要 Maven Checkstyle 配置。为了方便起见,有一个工具可以将配置映射到 IDE,以便可以在 Eclipse 构建期间应用验证(这就是 checkstyle-m2eclipse 集成的作用)。
一般来说,为您的配置提供一个规范源是一个好主意,从构建可移植性的角度来看,Maven 配置是最有意义的。因此,虽然您可能可以在技术上向另一个方向进行转变,但这样做并没有获得太多好处。出于兴趣,您认为这种转变会给您带来什么好处?
Not all data transformations are bidirectional, so it does not necessarily follow that because you can transform from Checkstyle to Eclipse that the inverse transformation can be applied.
In this case I think it is more a case of requirements and having a single canonical configuration source. The Maven Checkstyle configuration is required for all Maven builds. As a convenience it makes sense to have a tool that maps the configuration into the IDE so the validations can be applied during the Eclipse build (this is what the checkstyle-m2eclipse integration does).
Generally it's a good idea to have one canonical source for your configuration, and it makes most sense from a build portability perspective for that to be the Maven configuration. So while you could probably technically transform in the other direction you aren't gaining much by doing so. Out of interest, what benefit do you think this transformation would be to you?