PR: MNG-998

link modules in the reactor

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@330221 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-11-02 09:10:28 +00:00
parent 28c51a2915
commit b9bef589d8
1 changed files with 32 additions and 6 deletions

View File

@ -101,6 +101,22 @@ public class IdeaMojo
*/
private boolean overwrite;
/**
* Whether to link the reactor projects as dependency modules or as libraries.
*
* @parameter expression="${linkModules}" default-value="true"
*/
private boolean linkModules;
/**
* The reactor projects in a multi-module build.
*
* @parameter expression="${reactorProjects}"
* @required
* @readonly
*/
private List reactorProjects;
public void execute()
throws MojoExecutionException
{
@ -383,7 +399,22 @@ public class IdeaMojo
Artifact a = (Artifact) i.next();
Xpp3Dom dep = createElement( component, "orderEntry" );
if ( a.getFile() != null )
boolean found = false;
if ( reactorProjects != null && linkModules )
{
for ( Iterator j = reactorProjects.iterator(); j.hasNext() && !found; )
{
MavenProject p = (MavenProject) j.next();
if ( p.getGroupId().equals( a.getGroupId() ) && p.getArtifactId().equals( a.getArtifactId() ) )
{
dep.setAttribute( "type", "module" );
dep.setAttribute( "module-name", a.getArtifactId() );
found = true;
}
}
}
if ( a.getFile() != null && !found )
{
dep.setAttribute( "type", "module-library" );
dep = createElement( dep, "library" );
@ -397,11 +428,6 @@ public class IdeaMojo
createElement( dep, "JAVADOC" );
createElement( dep, "SOURCES" );
}
else
{
dep.setAttribute( "type", "module" );
dep.setAttribute( "module-name", a.getArtifactId() );
}
}
FileWriter writer = new FileWriter( moduleFile );