Thursday, 16 November 2017

IDE Golden Rule

Do you  have a very large project composed of many projects / modules and stuff? You think it's easy to create the project in IntelliJ or other IDE? Think twice.

Practically you can create the project from existing sources if you already took them from your VCS or directly from VCS. After you add first Project / Module by selecting the pom.xml file you have to do some more things:

- be sure you use the correct maven settings xml file (in File/Settings/Maven configuration)
- be sure to select the needed profiles

Then you move on adding other Modules from existing sources. (There is no option in Intellij to add modules from VCS). You should also select the pom.xml file and not the directory to avoid the hassle.

This is just a path to follow. But what I was recently seen was a lot of errors in IntelliJ for not resolving classes even if they were there. Tried File/Invalidate caches & restart but with no success.
I started to tackle with all the modules and seems there were problems with dependencies.

Finally I found the problem. A lot of modules/projects were build with a custom maven script, so a lot of libraries, generated sources and stuff were polluting the actual local repository. When I created the project, IntelliJ found all of these and added them to dependencies and paths, generating internal conflicts.

So be aware. And have in mind an IDE Golden Rule:

"When you create a project from existing sources, be sure that what you have there is just a clean sources folder without anything else inside".

No comments:

Post a Comment