如何从 checkstyle.xml 转换为 Eclipse 代码样式格式/配置文件并再次转换回来?

发布于 2024-08-04 18:00:25 字数 315 浏览 5 评论 0原文

我有 Eclipse 代码格式化程序和配置文件 xml 文档,我想构建一个 checkstyle.xml,我可以在我的 Maven 构建中使用它来运行报告并生成 Eclipse 文件。 ma​​ven-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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无风消散 2024-08-11 18:00:25

并不是所有的数据转换都是双向的,因此并不一定因为您可以从 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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文