mirror of https://github.com/apache/maven.git
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:
parent
28c51a2915
commit
b9bef589d8
|
@ -101,6 +101,22 @@ public class IdeaMojo
|
||||||
*/
|
*/
|
||||||
private boolean overwrite;
|
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()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
|
@ -383,7 +399,22 @@ public class IdeaMojo
|
||||||
Artifact a = (Artifact) i.next();
|
Artifact a = (Artifact) i.next();
|
||||||
Xpp3Dom dep = createElement( component, "orderEntry" );
|
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.setAttribute( "type", "module-library" );
|
||||||
dep = createElement( dep, "library" );
|
dep = createElement( dep, "library" );
|
||||||
|
@ -397,11 +428,6 @@ public class IdeaMojo
|
||||||
createElement( dep, "JAVADOC" );
|
createElement( dep, "JAVADOC" );
|
||||||
createElement( dep, "SOURCES" );
|
createElement( dep, "SOURCES" );
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
dep.setAttribute( "type", "module" );
|
|
||||||
dep.setAttribute( "module-name", a.getArtifactId() );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileWriter writer = new FileWriter( moduleFile );
|
FileWriter writer = new FileWriter( moduleFile );
|
||||||
|
|
Loading…
Reference in New Issue