maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From epunza...@apache.org
Subject svn commit: r381891 - in /maven/plugins/trunk/maven-idea-plugin/src/main: java/org/apache/maven/plugin/idea/IdeaMojo.java resources/templates/default/module.xml
Date Wed, 01 Mar 2006 03:27:52 GMT
Author: epunzalan
Date: Tue Feb 28 19:27:51 2006
New Revision: 381891

URL: http://svn.apache.org/viewcvs?rev=381891&view=rev
Log:
PR: MIDEA-15
Submitted by: Geoffrey De Smet

Applied patch to support war module configuration in iml files

Modified:
    maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java
    maven/plugins/trunk/maven-idea-plugin/src/main/resources/templates/default/module.xml

Modified: maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java?rev=381891&r1=381890&r2=381891&view=diff
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java
(original)
+++ maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java
Tue Feb 28 19:27:51 2006
@@ -533,6 +533,56 @@
         setting.setAttribute( "value", getModuleFileUrl( warWebapp ) );
 
         component = findComponent( module, "WebModuleProperties" );
+
+        removeOldElements( component, "containerElement" );
+        List artifacts = project.getTestArtifacts();
+        for ( Iterator i = artifacts.iterator(); i.hasNext(); )
+        {
+            Artifact artifact = (Artifact) i.next();
+            if ( artifact.getScope().equals( "compile" ) || artifact.getScope().equals( "runtime"
) )
+            {
+                Xpp3Dom containerElement = createElement( component, "containerElement" );
+
+                boolean linkAsModule = false;
+                if ( reactorProjects != null && linkModules )
+                {
+                    for ( Iterator j = reactorProjects.iterator(); j.hasNext() &&
!linkAsModule; )
+                    {
+                        MavenProject p = (MavenProject) j.next();
+                        if ( p.getGroupId().equals( artifact.getGroupId() ) &&
+                            p.getArtifactId().equals( artifact.getArtifactId() ) )
+                        {
+                            linkAsModule = true;
+                        }
+                    }
+                }
+
+                if ( linkAsModule )
+                {
+                    containerElement.setAttribute( "type", "module" );
+                    containerElement.setAttribute( "name", artifact.getArtifactId() );
+                    Xpp3Dom methodAttribute = createElement( containerElement, "attribute"
);
+                    methodAttribute.setAttribute( "name", "method" );
+                    methodAttribute.setAttribute( "value", "1" );
+                    Xpp3Dom uriAttribute = createElement( containerElement, "attribute" );
+                    uriAttribute.setAttribute( "name", "URI" );
+                    uriAttribute.setAttribute( "value", "/WEB-INF/classes" );
+                }
+                else if ( artifact.getFile() != null )
+                {
+                    containerElement.setAttribute( "type", "library" );
+                    containerElement.setAttribute( "level", "module" );
+                    containerElement.setAttribute( "name", artifact.getArtifactId() );
+                    Xpp3Dom methodAttribute = createElement( containerElement, "attribute"
);
+                    methodAttribute.setAttribute( "name", "method" );
+                    methodAttribute.setAttribute( "value", "1" ); // IntelliJ 5.0.2 is bugged
and doesn't read it
+                    Xpp3Dom uriAttribute = createElement( containerElement, "attribute" );
+                    uriAttribute.setAttribute( "name", "URI" );
+                    uriAttribute.setAttribute( "value", "/WEB-INF/lib/" + artifact.getFile().getName()
);
+                }
+            }
+        }
+
         Xpp3Dom element = findElement( component, "deploymentDescriptor" );
         if ( element.getAttribute( "version" ) == null )
         {

Modified: maven/plugins/trunk/maven-idea-plugin/src/main/resources/templates/default/module.xml
URL: http://svn.apache.org/viewcvs/maven/plugins/trunk/maven-idea-plugin/src/main/resources/templates/default/module.xml?rev=381891&r1=381890&r2=381891&view=diff
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/main/resources/templates/default/module.xml
(original)
+++ maven/plugins/trunk/maven-idea-plugin/src/main/resources/templates/default/module.xml
Tue Feb 28 19:27:51 2006
@@ -43,4 +43,20 @@
      -->
   </component>
   <component name="ModuleRootManager"/>
+  <!-- If it's a war project:
+  <component name="WebModuleProperties">
+    <containerElement type="module" name="${dep.artifactId}">
+      <attribute name="method" value="1" />
+      <attribute name="URI" value="/WEB-INF/classes" />
+    </containerElement>
+    <containerElement type="library" level="module" name="${dep.artifactId}">
+      <attribute name="method" value="1" />
+      <attribute name="URI" value="/WEB-INF/lib/${dep.systemPath.name}" />
+    </containerElement>
+    <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/${pom.build.warSourceDirectory}/WEB-INF/web.xml"
version="" />
+    <webroots>
+      <root url="file://$MODULE_DIR$/${pom.build.warSourceDirectory}" relative="/" />
+    </webroots>
+  </component>
+  -->
 </module>



Mime
View raw message