views:

40

answers:

3

Hi all.

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  A: 

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

Kamal
You can provide some more information or atleast putthe errors details
Kamal
When using a Maven project, we cannot set classpath for the netbeans project properties... Maven integration makes netbeans compile with all jar specified in the dependencies in the pom.xmlDid I missed something?
Alban Soupper
A: 

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.

naikus
It is exactly how I work (maven called through command line or through nbactions)... And whatever I open/re-open projects, netbeans show me errors not raised by Maven.Everything happen like Netbeans and Maven do not use the same JDK or compile options...
Alban Soupper
A: 

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

mkleint