Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When and why is a reimport of all maven projects required?

Occasionally, after an SVN update where POM's have changed, IntelliJ does not seem to notice this and you start having strange behaviors (non-existing classes, methods, ...). I know now that reimporting all maven projects fixes the issue but I don't understand why this is necessary.

I have checked 'Import Maven projects automatically'.

I don't think it's a bug since this was already the case in version 12 and still is in 13.

like image 286
Stijn Geukens Avatar asked Dec 17 '13 13:12

Stijn Geukens


1 Answers

This behavior is usually a dependency problem relating to transitive dependencies. If you're relying on transitive dependencies between your modules then IntelliJ will likely have problems recognizing that an automatic re-import is needed. Best practice is to list all your direct dependencies in each module. Then, when a module is changed and rebuilt or re-imported the modules that depend on it will be rebuilt. So, my advice is check your dependencies and ensure that there are no transitives in your tree - 'mvn dependency:tree' may help.

like image 129
Software Engineer Avatar answered Oct 29 '22 17:10

Software Engineer