Wednesday, June 4, 2014

netbeans "package does not exist" error -- maven considered harmful

upgraded to netbeans 8 and found a bunch of cryptic errors in my projects:
package XXXXX does not exist
in this case XXXXX was a package provided by another netbeans project. it does indeed exist, the jar is being built properly and compiling the "broken" project succeeds and the application runs. so this is purely a problem with netbeans parser / indexer. i tried removing the dependency and re-adding it, cleaning and rebuilding, and exiting netbeans, removing the cache and restarting. nothing helped

looking thru messages.log, i see
WARNING [org.netbeans.modules.java.source.indexing.JavaIndex]: Ignoring root with no ClassPath: /home/YYYYY/working/nq0/XXXXX/XXXXX.git/src
didn't find much mention of that warning on the interwebs. looking at the "project properties" page for the project i realized i'd seen this problem before and started fiddling

the problem is that buried in the XXXXX directory, there's a pom.xml. netbeans detects this and somehow modifies how the project is managed. it's a "project with existing sources", not a maven project. but somehow netbeans fails to honor that when it finds a pom.xml

my solution was to deactivate the maven plugin (why that gets installed in the first place is beyond me). which eliminates the issue (i reactivated it temporarily to verify that that was actually the problem). this happened when i upgraded to netbeans 7, and i'm sure this will happen again when i upgrade to 8

maven is terrible, and the plugin makes it worse. it's the wrong metaphor for managing dependencies

2 comments:

Mat Jaggard said...

THANK YOU!!

I already hate Maven and was starting to hate Netbeans too!

Anonymous said...

Bet Casino Review: Welcome Bonus, Welcome Bonus, Tips
Bet Casino. Online Casino 퍼스트카지노 Bonus, Welcome Bonus, Tips, Casino Bonuses, Banking 온카지노 Options. Bet Casino. 카지노사이트 Online Casino Bonus. Bet Casino. Deposit Methods.