Eclipse 仅编译引用的类(如何设置 Intellij 来执行相同的操作)
我有一个模块,它有一个名为共享的模块依赖项,它包含所有应用程序中的大部分应用程序代码。共享中有一些类引用,例如 servlet 3.0 API(jar 依赖项),这些类在本模块中没有使用,还有其他一些东西。 Intellij 看起来像是编译模块中的所有内容,与 eclipse 不同,包括使用 maven 编译时。对于 Eclipse,Eclipse 仅编译导入到应用程序中的文件。有办法改变这个吗?
有没有关于 eclipse 如何构建项目的文档?它如何知道忽略源文件夹中未在项目中引用的文件。
I have a module that has a module dependency called shared which has the majority of my applications code across all applications. There are classes in shared that reference for example the servlet 3.0 API (jar dependency) that are not used in this module among a bunch of other stuff. Intellij looks like it compiles everything in a module, unlike eclipse, including when compiling with maven. With Eclipse, eclipse only compiles files that are imported into the application. Is there a way to change this?
Is there documentation for how eclipse builds projects? How it knows to ignore files in source folders that are not referenced in a project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
IDEA 编译模块中的所有类,这是设计使然。您可以在编译器设置中从编译中排除某些类或目录。
IDEA compiles all the classes in the module, it's by design. You can exclude certain classes or directories from compilation in the compiler settings.
依赖于一个大模块,而其中只有一小部分被实际使用,可能是一个坏主意。我建议重构你的模块结构。这不仅解决了您的问题,还使其他人更清楚真正的依赖关系。
Depending on a large module, of which is only a small part is actually used, is probably a bad idea. I'd suggest refactoring your module structure. This does not only solve your problem, it also makes the true dependencies clearer to everybody else.