Netbeans & Maven: different compilation behavior

浪尽此生 提交于 2019-12-07 09:30:03

问题


I am using Netbeans and Maven projects.
In some case Netbeans show me compilation failures (red ballon) BUT Maven compile everything without any problem!

What can be the reason of this difference. I already checked that both are using the same JDK version.


回答1:


One possible reason could be that you have not added the required jar in your net beans class path. But the jar is being listed in your maven pom.xml




回答2:


Try doing this, do an mvn install once from your command line in your project directory, and then re-open or reload the project in your netbeans IDE (I hope you are using 6.9?).

This will install all the artifacts in your local repo.

This usually happens if you have modules in your maven project and they depend on each other.




回答3:


some more details would be needed for more in-depth analysis.

In most cases a difference in compilation errors between cmdline and netbeans editor can be caused by missing source roots (read generated source roots - see the project properties Sources panel on how to setup source roots).

netbeans is embedding an old svn HEAD snapshot maven binaries so in some very rare cases there could be differences in resolving the dependency tree, but I have yet to see such case.

also the netbeans compiler doesn't pick up most of the switches defined on the compiler plugin apart from target/source, encoding.

The netbeans editor compiler is not 100% compatible with jdk compiler and there have been cases of incompatibilities so we are back to the need to see the actual errors first..



来源:https://stackoverflow.com/questions/3455958/netbeans-maven-different-compilation-behavior

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!