用Maven进行部分汇编?

发布于 2025-02-03 16:36:53 字数 670 浏览 1 评论 0原文

我对使用Maven部分编译Java项目感兴趣。通过部分编译,我的意思是要尽可能多地编译代码,至少可以使用Intellij中的Eclipse编译器来编译。

在一个并非所有文件编译的Java项目中,我都设法使用Intellij中的Eclipse编译器来编译可以编译的项目的部分。虽然我已经设法使用plexus-compiler-eclipse来使用Eclipse编译器使Maven不在编译错误上,而似乎至少编译了某些文件,但我意识到当我在Intellij中重建项目时,我实际上是我的实际上即使对于不整体编译的来源文件中的某些方法,也可以获取更多可运行的字节代码。当使用损坏的代码库时,例如在大型重构期间和类似的情况下,这是相当有用的,我想知道我是否可以通过Maven实现相同的结果。

我的目标是要尽可能多地编译代码,并运行可运行的测试。目前,我无法进行MVN测试使用Plexus-Compiler-Eclipse“编译”项目后,可能是因为测试设置所需的某些代码属于在只能部分编译的文件中。作为基准,如果我已经使用Intellij预先编译该项目,则实际上可以进行MVN测试

请注意问题公式。我对部分汇编作为开发工具感兴趣,并且修复编译错误不会为我提供所寻求的工具。

我确实意识到这个问题可能有些不适,如果回答问题的困难,我想我可以尝试解决一个最小的可行示例。

I'm interested in partially compiling Java projects using Maven. By partially compiling, I mean to compile as much of the code as possible, and at least as much as can be compiled using the Eclipse compiler in IntelliJ.

In a Java project where not all files compile, I've managed to use the Eclipse compiler in IntelliJ to compile parts of the project that can be compiled. While I have managed to use the eclipse compiler using plexus-compiler-eclipse to make Maven not choke on compile errors while seemingly compile at least some files, I realized that when I rebuild the project in IntelliJ I actually get more runnable byte code, even for some methods in sources files that do not compile as a whole. This is rather useful when working with a broken code base, e.g. during large refactorings and similar, and I wonder if I can achieve the same result with Maven.

My goal is to have a Jenkins job that compiles as much of the code as it can, and runs the tests that are runnable. At the moment, I cannot do do an mvn test after having "compiled" the project using plexus-compiler-eclipse, likely because some of the code needed for test setup resides in files that can only be partially compiled. As a benchmark, I can actually do an mvn test if I have pre-compiled that project with IntelliJ.

Please note problem formulation. I'm interested in partial compilation as a development tool, and fixing the compilation errors will not provide me with the tool I seek.

I do realize that the problem may be a bit ill-posed, and if difficulties arise in answering it I guess I can try to work out a minimal workable example.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文