Netbeans & Maven: different compilation behavior
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开发者_如何学JAVA the same JDK version.
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
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.
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..
精彩评论