Carlos Bribiescas
Carlos Bribiescas

Reputation: 4427

How do I rebuild/make .iml files in maven multi-module project in Intellij 13.1.4

I'm working in a multi-module maven project in Intellij. There was a snapshot update in another module which required an update in a few POMs. Normally I will click the "Re-import all maven projects" from the maven plugins tool then do a full build.

However, this time the .iml files associated with the changed POMs weren't being updated. It wasn't until I did "Build->Rebuild Project" that the .iml files were updated. Does anyone know how to update .iml files as part of a build configuration?

Note: Before rebuilding the project, I know mvn at least picked up on the change because my local .m2 repo had the latest snapshot.

EDIT #1: So, this is also true if I add a maven runtime dependency in a module. It won't pick up the change unless I do rebuild project.

Upvotes: 13

Views: 25212

Answers (2)

ilooner
ilooner

Reputation: 2550

I've experienced similar issues with newer versions of IntelliJ (2018.2.7) where my .iml is out of date. It happens inconsistently, so I'm not sure what the root cause is, but the following work around allows me to avoid doing a full rebuild:

  1. Delete the .iml file and .idea folder for the project
  2. Reimport the pom.xml for the project
  3. IntelliJ will automagically regenerate an updated .iml file.

Upvotes: 4

Had the same issue and in addition to deleting the .iml file as in the previous answer, delete the .idea folder as well and restart the IDE or import the project by pom file.

new .iml file is created with all maven dependencies

Upvotes: 4

Related Questions