8

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.

5
  • Import Maven projects automatically should handle such situations. If it doesn't work, please file a bug with the steps to reproduce and a test case.
    – CrazyCoder
    Dec 17, 2013 at 14:36
  • Just had the issue again; all our pom's were updated from snapshot-X to snapshot-Y. A make showed errors that did not seem to be valid. An import all and make fixed the problem. This is not just me by the way, we all have migrated from eclipse to IntelliJ and all have this issue now and then. Dec 17, 2013 at 14:50
  • To be clear, this is not a reason to go back to eclipse :-). Dec 17, 2013 at 14:51
  • Do you have Use Maven3 option in the Settings | Maven | Importing enabled?
    – CrazyCoder
    Dec 17, 2013 at 14:52
  • If you mean 'Use Maven3 to import project' then yes. Actually, apart from the first checkbox (Keep project files in) all are checked on this settings page. Dec 17, 2013 at 15:18

1 Answer 1

7

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.

2
  • Tx. We have about 140 (maven) projects so it would be some work to check all of them but if I get it chance I'll try to reproduce this on some test workspace. Dec 19, 2013 at 8:54
  • Problem resolved by listing all dependencies to our other artifacts in the dependency management of the parent pom if our project. It's very similar to what you suggested so thanks for the tip. Apr 29, 2014 at 14:23

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.