Cannot Find Character Errors in NetBeans

I am working on a school project using NetBeans 7, Maven and the NetBeans platform. The project was created using the project template "Maven / POM Project". This is a multi-level "corporate" application that uses several modules (model, integration, business, presentation, the client application itself and several others).

There are dependencies between these modules (but not circular dependencies). The problem is that Maven or NetBeans keep getting confused. There are several types of problems that appear without any triggers. I must continue to recompile the modules, close and reopen NetBeans, clear the NetBeans cache, delete and read dependencies, etc., to temporarily remove the problems. I have all these problems with two different NetBeans installations on Windows XP SP3 and Mac OS X.

Symptoms

1) Sometimes NetBeans decides that none of the classes imported from another module exist (and I get cannot find symbol errors. This happens repeatedly, sometimes into modules that I successfully compiled a few seconds ago. In most cases, the dependency is not recompiled The necessary dependencies are declared in the POM, jar files exist, and if I deploy them in the project view, I can see the classes in question.

2) Sometimes NetBeans decides that the method of the imported class does not actually throw an exception, which it declares to throw. Since calls to such methods are usually surrounded by try blocks, NetBeans displays an error with the message a.package.SomeException is never thrown in body of corresponding try statement . If I do not delete the try block, the module does not compile due to NetBeans. If you delete a block, the module does not compile due to Maven (Maven, for some reason, may see an exception and complains that it is not caught). This also happens repeatedly; I'm not quite sure how to fix this reliably.

At this point, the problems with Maven and NetBeans are so bad that I cannot actually work on the project. If I had not had to use NetBeans and Maven, I would have returned to vim and Makefiles. Does anyone even recognize these problems?

EDIT: I submitted the project, got 30 out of 20 points for it for the extra work that I did on this, and until it leaves the alpha stage, I hope to never have to work with NetBeans again.

+7
source share
5 answers

I had is never thrown disguise a cannot find symbol in a multi-module maven project in Netbeans 7.0.0

This character was a class in another module of my maven project.

I will refactor / rename a class that was not found - this fixed the problem. Then I renamed it back - the problem remained unchanged.

Not perfect in any way, but decided that I would share.

+2
source

I had a problem with the netbeans 'error error ... An exception never throws itself into the body of the corresponding try statement' The project will be built normally, but the error messages will not disappear. Finally, corrected it by firing and reopening the grid.

I am on a mac and the close button does not actually close the netbeans, you need to make a full exit.

0
source

Extracting the dependencies, creating (and getting compilation errors) and then re-adding it (manually, from pom.xml or from the interface) helped me. But I agree that this is a serious mistake.

0
source

I came across this once with NetBeans 8.0.2. The problem was clearly related to the Lombok project, but I have no idea why this happened. I installed maven and did "mvn clean install" in each of my projects, and it seems to fix the problem. After that, NetBeans started working again.

0
source

If you have several projects, be careful with the compile netbeans option when saving, if some of your dependencies have enabled this option, compilation of your main project will fail, disable automatic compilation when saving, recompile the dependencies (clean and build), and everything should be fine .

-one
source

All Articles