diff --git a/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java b/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java index 2437465d8d..f03c9e3bac 100644 --- a/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java +++ b/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java @@ -241,11 +241,16 @@ public class IdeaMojo { removeOldElements( modules, "module" ); + Xpp3Dom m = createElement( modules, "module" ); + String projectPath = new File( project.getBasedir(), + project.getArtifactId() + ".iml" ).getAbsolutePath(); + m.setAttribute( "filepath", "$PROJECT_DIR$/" + toRelative( project.getBasedir(), projectPath ) ); + for ( Iterator i = project.getCollectedProjects().iterator(); i.hasNext(); ) { MavenProject p = (MavenProject) i.next(); - Xpp3Dom m = createElement( modules, "module" ); + m = createElement( modules, "module" ); String modulePath = new File( p.getBasedir(), p.getArtifactId() + ".iml" ).getAbsolutePath(); m.setAttribute( "filepath", "$PROJECT_DIR$/" + toRelative( project.getBasedir(), modulePath ) ); }