Author: jvanzyl
Date: Sun Jul 31 12:20:33 2005
New Revision: 226683

URL: http://svn.apache.org/viewcvs?rev=226683&view=rev
Log:
o http://jira.codehaus.org/browse/MNG-420


Modified:
    
maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java

Modified: 
maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java?rev=226683&r1=226682&r2=226683&view=diff
==============================================================================
--- 
maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java
 (original)
+++ 
maven/components/trunk/maven-plugins/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaMojo.java
 Sun Jul 31 12:20:33 2005
@@ -40,7 +40,7 @@
  * Goal for generating IDEA files from a POM.
  *
  * @goal idea
- * @executePhase generate-sources
+ * @execute phase="generate-sources"
  * @requiresDependencyResolution test
  * @todo use dom4j or something. Xpp3Dom can't cope properly with entities and 
so on
  */
@@ -59,6 +59,14 @@
      */
     private MavenProject executedProject;
 
+    /**
+     * Specify the name of the registered IDEA JDK to use
+     * for the project.
+     *
+     * @parameter
+     */
+    private String jdkName;
+
     public void execute()
         throws MojoExecutionException
     {
@@ -125,6 +133,16 @@
                 IOUtil.close( reader );
             }
 
+            // Set the jdk name if set
+            if ( jdkName != null )
+            {
+                setJdkName( module );
+            }
+            else
+            {
+                getLog().warn( "jdkName is not set, you will have to set the 
JDK to use in IDEA." );
+            }
+
             Xpp3Dom component = findComponent( module, "ProjectModuleManager" 
);
             Xpp3Dom modules = findElement( component, "modules" );
 
@@ -337,6 +355,12 @@
         element = createElement( element, "root" );
         element.setAttribute( "relative", "/" );
         element.setAttribute( "url", getModuleFileUrl( warSrc ) );
+    }
+
+    private void setJdkName( Xpp3Dom content )
+    {
+        Xpp3Dom component = findComponent( content, "ProjectRootManager" );
+        component.setAttribute( "project-jdk-name", jdkName );
     }
 
     private void addSourceFolder( Xpp3Dom content, String directory, boolean 
isTest )



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to