I'm having issues with IntelliJ building when I make changes to maven files.

Originally from http://stackoverflow.com/questions/25769094/how-do-i-rebuild-make-iml-files-in-maven-multi-module-project-in-intellij-13-1

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.

Comment actions Permalink


I'm not quite sure what's going on in your case, because you speak about files. But .iml files may be written not at the moment when the IDEA project is updated, but later. It's normal.

To understand the case we need to check Project Structure dialog. You do Re-import Maven projects. When it completes, open Project Structure. Are the changes inside? If they are, then everything is Ok.


Comment actions Permalink

Do you mean inside the project library as in its in the External Library Settings?

So files aside, the issue is that when I do a make dependency change it won't recognize the changes without doing a "Build Project."  That is, it will error at runtime if I haven't re-imported maven AND clean install AND rebuild project.  My understanding is that I should only have to do re-import maven.

Comment actions Permalink

I meant Project Structure dialog, not a tree view. But I have understood that the model is really not updated for you, thanks.

This is not a normal behavior, but I don't know the reason of it. Please try main menu / Help / Show Log and check idea.log content after Maven import: does it contain some exception traces or error messages?


Comment actions Permalink

No, I dont get any errors while re-importing maven settings.  However I do get this error for many modules when I'm Deploying

2014-10-03 16:47:06,020 [1619421]   INFO - tbrains.idea.tomcat.TomcatUtil - Cannot load  <PATH>/target/testing-ws/META-INF/context.xml:  <PATH>/target/testing-ws/META-INF/context.xml (No such file or directory)

com.intellij.execution.ExecutionException: Cannot load  <PATH>/target/testing-ws/META-INF/context.xml:  <PATH>/target/testing-ws/META-INF/context.xml (No such file or directory)

 at org.jetbrains.idea.tomcat.TomcatUtil.loadXMLFile(TomcatUtil.java:144)

 at org.jetbrains.idea.tomcat.TomcatUtil.findContextInContextXml(TomcatUtil.java:92)

 at org.jetbrains.idea.tomcat.TomcatUtil.findContextElement(TomcatUtil.java:319)

 at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl$4.doPerform(TomcatAdminLocalServerImpl.java:128)

 at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl$DeployStep.perform(TomcatAdminLocalServerImpl.java:289)

 at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl.doDeploy(TomcatAdminLocalServerImpl.java:122)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$4.doPerform(JavaeeJmxAdminServerBase.java:120)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$JmxOperation.perform(JavaeeJmxAdminServerBase.java:243)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase.doStartDeploy(JavaeeJmxAdminServerBase.java:111)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$2.setDeploymentStatus(JavaeeJmxAdminServerBase.java:90)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$DeploymentModelOperation.doSetDeploymentStatus(JavaeeJmxAdminServerBase.java:270)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$3.doPerform(JavaeeJmxAdminServerBase.java:100)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase$JmxOperation.perform(JavaeeJmxAdminServerBase.java:243)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase.doStartDeployWithUndeploy(JavaeeJmxAdminServerBase.java:95)

 at com.intellij.javaee.oss.admin.jmx.JavaeeJmxAdminServerBase.startDeploy(JavaeeJmxAdminServerBase.java:74)

 at org.jetbrains.idea.tomcat.admin.TomcatAdminServerBase.startDeploy(TomcatAdminServerBase.java:119)

 at org.jetbrains.idea.tomcat.admin.TomcatAdminLocalServerImpl.startDeploy(TomcatAdminLocalServerImpl.java:101)

 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

 at java.lang.reflect.Method.invoke(Method.java:597)

 at com.intellij.remoteServer.agent.impl.ThreadInvocationHandler$1.call(ThreadInvocationHandler.java:54)

 at com.intellij.remoteServer.agent.impl.ThreadInvocationHandler$2.run(ThreadInvocationHandler.java:127)

 at com.intellij.remoteServer.agent.impl.util.SequentialTaskExecutor$1.run(SequentialTaskExecutor.java:31)

 at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)

 at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)

 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)

 at java.util.concurrent.FutureTask.run(FutureTask.java:138)

 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)

 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)

 at java.lang.Thread.run(Thread.java:695)

 at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)

Caused by: java.io.FileNotFoundException: <PATH>/target/testing-ws/META-INF/context.xml (No such file or directory)

 at java.io.FileInputStream.open(Native Method)

 at java.io.FileInputStream.<init>(FileInputStream.java:120)

 at com.intellij.openapi.util.JDOMUtil.loadDocument(JDOMUtil.java:340)

 at org.jetbrains.idea.tomcat.TomcatUtil.loadXMLFile(TomcatUtil.java:138)

 ... 31 more

So, when i booted up IntelliJ I deleted a necessary dependency and it worked with out having to rebuild project. Afterwards I re-added/re-deleted it without rebuilding project and it didn't work.  So its weird that it worked on a fresh startup.  (But maybe diagnostically useful)

Comment actions Permalink

No, this trace is just a debug information, and not a problem. Here is a bit from the developer about that:

Comment actions Permalink

Cool, thanks for that.  Do you know what could be causing my build issues?

Comment actions Permalink

No suggestions yet, sorry. If it's possible, you can attach your project here, may be I will reproduce the problem on my side.

Comment actions Permalink

I can't attach the project becuase it has company IP.  But today I'll try to make time to create a new dummy project that has the issue.

Comment actions Permalink

One thing I noticed is that when setting the maven policy for "Plugin Update Policy:" it has a note that it is "ignored by Maven 3+".  My maven directory is set to "/Users/carlos/workspace/dev/apache-maven/current" becuase I use a symbolic link to manage which version is current.  Does Intellij do something like parse the path to get the version?  If so, would this cause issues if my maven version is 3.0.5?


Please sign in to leave a comment.