Maven m2e 强制执行自己的编译器设置 - 禁用
启动 Eclipse 后,Mven 似乎将编译器设置设置为 1.5,并忘记所有其他全局代码样式设置,以确保更高的代码质量。
有什么办法可以禁用这个功能吗?或者我可以在 POM 中指定所有编译器和代码风格检查吗?
这非常烦人,因为 Ecplise 无法运行应用程序,因为不允许覆盖接口注释。 Java 编译器
中的勾号 -> 启用项目特定设置
始终在重新启动后设置。
After starting Eclipse, Mven seems to set the compiler settings to 1.5 and forget all the other global code style settings to ensure a higher code quality.
Is there some way to disable this feature? Or can I specify all compiler and code style checks in my POM?
It is very annoying because Ecplise can't run the app because of not allowed override annotations for interfaces. The tick in Java compiler
-> Enable project specific settings
is always set after a restart.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以在 pom 中设置编译器源和目标(字节码)版本。
请参阅 http://maven。 apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
代码风格检查可以在 pom 中配置为 Maven 报告的一部分,请参阅 http://maven.apache.org/plugins/maven-checkstyle-plugin/
但我不确定集成是否会接受这些。
You can set the compiler source and target (byte-code) versions in your pom.
See http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
Code style checks can be configured in the pom as part of the maven reports, see http://maven.apache.org/plugins/maven-checkstyle-plugin/
but I'm not sure whether the integration will pick these up.
最简单的方法是添加到 POM,
请参阅默认 Maven 编译器设置了解其他解决方案。
The simplest way is to add to your POM
See default maven compiler setting for another solutions.
如果您不希望 m2e eclipse 插件主动干扰您的项目设置,请使用 maven-eclipse-plugin 的 eclipse 目标 生成您的 eclipse 设置。
它将根据您的 pom 中的内容生成 eclipse 设置,因此如果您不想每次重新生成 eclipse 项目文件时都设置它们,您仍然需要在 pom 中设置 Maven 编译器设置你更新你的pom。
如果您查看该插件的详细配置,就会发现有关如何生成各种 Eclipse 元数据的说明。
If you don't want the m2e eclipse plugin actively messing with your project settings, use the maven-eclipse-plugin's eclipse goal to generate your eclipse settings.
It'll generate your eclipse settings based off of what you have in your pom, so you'll still need to set the maven compiler settings in your pom if you don't want to set them every time you regenerate your eclipse project files when you update your pom.
If you take a look at the detailed configuration for that plugin, there are instructions for how to generate various pieces of eclipse metadata.