简体   繁体   中英

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 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..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM