Author: brett
Date: Wed Sep 21 22:12:16 2005
New Revision: 290892
URL: http://svn.apache.org/viewcvs?rev=290892&view=rev
Log:
PR: MNG-938
Submitted by: Johnny R. Ruiz III
documentation for IDEA plugin
Added:
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/howto.apt
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/introduction.apt
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/site.xml
(with props)
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=290892&r1=290891&r2=290892&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
Wed Sep 21 22:12:16 2005
@@ -38,6 +38,7 @@
/**
* Goal for generating IDEA files from a POM.
+ * This plug-in provides the ability to generate IDEA project files (.ipr and
.iws files) for IDEA
*
* @goal idea
* @execute phase="generate-sources"
@@ -48,6 +49,8 @@
extends AbstractMojo
{
/**
+ * The Maven Project.
+ *
* @parameter expression="${project}"
* @required
* @readonly
@@ -55,6 +58,8 @@
private MavenProject project;
/**
+ * The Maven Project.
+ *
* @parameter expression="${executedProject}"
*/
private MavenProject executedProject;
@@ -83,6 +88,11 @@
rewriteWorkspace();
}
+ /**
+ * Create IDEA workspace (.iws) file.
+ *
+ * @throws MojoExecutionException
+ */
private void rewriteWorkspace()
throws MojoExecutionException
{
@@ -107,6 +117,11 @@
}
}
+ /**
+ * Create IDEA (.ipr) project files.
+ *
+ * @throws MojoExecutionException
+ */
private void rewriteProject()
throws MojoExecutionException
{
@@ -190,6 +205,11 @@
}
}
+ /**
+ * Create IDEA (.iml) project files.
+ *
+ * @throws MojoExecutionException
+ */
private void rewriteModule()
throws MojoExecutionException
{
@@ -311,6 +331,11 @@
}
}
+ /**
+ * Adds the Web module to the (.iml) project file.
+ *
+ * @param module Xpp3Dom element
+ */
private void addWebModule( Xpp3Dom module )
{
// TODO: this is bad - reproducing war plugin defaults, etc!
@@ -368,12 +393,25 @@
element.setAttribute( "url", getModuleFileUrl( warSrc ) );
}
+ /**
+ * Sets the name of the JDK to use.
+ *
+ * @param content Xpp3Dom element.
+ * @param jdkName Name of the JDK to use.
+ */
private void setJdkName( Xpp3Dom content, String jdkName )
{
Xpp3Dom component = findComponent( content, "ProjectRootManager" );
component.setAttribute( "project-jdk-name", jdkName );
}
+ /**
+ * Adds a sourceFolder element to IDEA (.iml) project file
+ *
+ * @param content Xpp3Dom element
+ * @param directory Directory to set as url.
+ * @param isTest True if directory isTestSource.
+ */
private void addSourceFolder( Xpp3Dom content, String directory, boolean
isTest )
{
if ( !StringUtils.isEmpty( directory ) && new File( directory
).isDirectory() )
@@ -384,8 +422,15 @@
}
}
- // TODO: to FileUtils
+ // TODO: to FileUtils
+ /**
+ * Translate the absolutePath into its relative path.
+ *
+ * @param basedir The basedir of the project.
+ * @param absolutePath The absolute path that must be translated to
relative path.
+ * @return relative Relative path of the parameter absolute path.
+ */
private static String toRelative( File basedir, String absolutePath )
{
String relative;
@@ -404,6 +449,12 @@
return relative;
}
+ /**
+ * Translate the relative path of the file into module path
+ *
+ * @param file File to translate to ModuleFileUrl
+ * @return moduleFileUrl Translated Module File URL
+ */
private String getModuleFileUrl( String file )
{
return "file://$MODULE_DIR$/" + toRelative( project.getBasedir(), file
);
@@ -411,6 +462,12 @@
// TODO: some xpath may actually be more appropriate here
+ /**
+ * Remove elements from content (Xpp3Dom).
+ *
+ * @param content Xpp3Dom element
+ * @param name Name of the element to be removed
+ */
private void removeOldElements( Xpp3Dom content, String name )
{
Xpp3Dom[] children = content.getChildren();
@@ -424,6 +481,11 @@
}
}
+ /**
+ * Removes dependencies from Xpp3Dom component.
+ *
+ * @param component Xpp3Dom element
+ */
private void removeOldDependencies( Xpp3Dom component )
{
Xpp3Dom[] children = component.getChildren();
@@ -437,6 +499,13 @@
}
}
+ /**
+ * Finds element from the module element.
+ *
+ * @param module Xpp3Dom element
+ * @param name Name attribute to find
+ * @return component Returns the Xpp3Dom element found.
+ */
private Xpp3Dom findComponent( Xpp3Dom module, String name )
{
Xpp3Dom[] components = module.getChildren( "component" );
@@ -453,6 +522,13 @@
return component;
}
+ /**
+ * Returns a an Xpp3Dom element (setting).
+ *
+ * @param component Xpp3Dom element
+ * @param name Setting attribute to find
+ * @return setting Xpp3Dom element
+ */
private Xpp3Dom findSetting( Xpp3Dom component, String name )
{
Xpp3Dom[] settings = component.getChildren( "setting" );
@@ -469,6 +545,13 @@
return setting;
}
+ /**
+ * Creates an Xpp3Dom element.
+ *
+ * @param module Xpp3Dom element
+ * @param name Name of the element
+ * @return component Xpp3Dom element
+ */
private static Xpp3Dom createElement( Xpp3Dom module, String name )
{
Xpp3Dom component = new Xpp3Dom( name );
@@ -476,6 +559,13 @@
return component;
}
+ /**
+ * Finds an element from Xpp3Dom component.
+ *
+ * @param component Xpp3Dom component
+ * @param name Name of the element to find.
+ * @return the element
+ */
private Xpp3Dom findElement( Xpp3Dom component, String name )
{
Xpp3Dom element = component.getChild( name );
Added:
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/howto.apt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/howto.apt?rev=290892&view=auto
==============================================================================
---
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/howto.apt
(added)
+++
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/howto.apt
Wed Sep 21 22:12:16 2005
@@ -0,0 +1,36 @@
+ ------
+ Maven 2 Idea Plugin
+ ------
+ Johnny R. Ruiz III
+ <[EMAIL PROTECTED]>
+ ------
+ September 21, 2005
+
+How to Use
+
+ You can directly use this plugin without configuring anything using the
command "m2 idea:idea".
+
+ To configure what JDK name you want to use, you must specify the parameter
"jdkName" in the pom.xml
+
+-------------------
+<project>
+ ...
+ <build>
+ ...
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <jdkName>Put_jdkName_Here</jdkName>
+ </configuration>
+ </plugin>
+ </plugins>
+ ...
+ </build>
+ ...
+</project>
+-------------------
+
+ For full documentation, click {{{index.html}here}}.
+
Added:
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/introduction.apt
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/introduction.apt?rev=290892&view=auto
==============================================================================
---
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/introduction.apt
(added)
+++
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/apt/introduction.apt
Wed Sep 21 22:12:16 2005
@@ -0,0 +1,14 @@
+ ------
+ Maven 2 Idea Plugin
+ ------
+ Johnny R. Ruiz III
+ <[EMAIL PROTECTED]>
+ ------
+ September 21, 2005
+
+Introduction
+
+ This plugin generates IDEA project file, workspace file, and module file for
a project.
+
+
+
Added: maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/site.xml
URL:
http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/site.xml?rev=290892&view=auto
==============================================================================
--- maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/site.xml
(added)
+++ maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/site.xml
Wed Sep 21 22:12:16 2005
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<project name="Maven Idea Plugin">
+ <bannerLeft>
+ <name>Maven Idea Plugin</name>
+ <src>http://maven.apache.org/images/apache-maven-project.png</src>
+ <href>http://maven.apache.org/</href>
+ </bannerLeft>
+ <bannerRight>
+ <src>http://maven.apache.org/images/maven-small.gif</src>
+ </bannerRight>
+ <body>
+ <links>
+ <item name="Maven 2" href="http://maven.apache.org/maven2/"/>
+ </links>
+
+ <menu name="Overview">
+ <item name="Introduction" href="introduction.html"/>
+ <item name="How to Use" href="howto.html"/>
+ </menu>
+ ${reports}
+ </body>
+</project>
Propchange:
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/components/trunk/maven-plugins/maven-idea-plugin/src/site/site.xml
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]