Search code examples
javaintellij-ideaintellij-13

IntelliJ doesn't detect Java errors


I'm using IntelliJ IDEA13 for a MVC project using hibernate, struts, etc, but my Intellij doesn't detect any errors when i'm writing code for example when I make and object that requires a certain import, even if I do stupid things with the code it doesn't show at red any errors. I'm compiling the files with ant and not with IntelliJ, but an IDE it's very usefull specially to imports and autocomplete and I don't know why this is happening. Any ideas?

EDIT: This only happens in this MVC project (> 2.000 files), in a normal Java project everything is fine.

I have 1 folder with the name "project1", inside that folder i have other 2 folders: common has all the jars that i need and impl has all the files of the project.

enter image description here

So the way i did to put all of this in IntelliJ was to create a new project with the name "project1" so that IntelliJ got all the folders and files.

Maybe it's because of that and something is wrong in the configuration.

Just a quick example, if i call Query q = createQuery("select * c.name from c in class " + Category.class.getName() + " order by c.name desc"); I don't have the import for the class Query so IntelliJ should tell me to import that class and make Query red, but it doesn't and even when i click alt+enter in Query it doesn't show me the option to import that class, my IntelliJ doesn't know that are errors in the code.

EDIT2: I made a new module and everything seems to be working now. I had the wrong source folder in the module.


Solution

  • These problems are all solved if you use maven rather than ant. This is one of the main reasons 99% of professional projects use maven. You must tell intellij where your source folders are: in the project settings select the folder where your source is, and mark it as source, then do the same for your tests. You must also assign a jdk.