You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by de...@apache.org on 2007/07/15 00:18:14 UTC

svn commit: r556344 - in /maven/plugins/trunk/maven-idea-plugin/src: main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java main/java/org/apache/maven/plugin/idea/Library.java site/apt/examples/customize-libraries.apt site/apt/library.apt

Author: dennisl
Date: Sat Jul 14 15:18:12 2007
New Revision: 556344

URL: http://svn.apache.org/viewvc?view=rev&rev=556344
Log:
[MIDEA-99] Allow the library to define a link to external javadoc.
Submitted by: Roman Zenka
Reviewed by: Dennis Lundberg

Modified:
    maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
    maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/Library.java
    maven/plugins/trunk/maven-idea-plugin/src/site/apt/examples/customize-libraries.apt
    maven/plugins/trunk/maven-idea-plugin/src/site/apt/library.apt

Modified: maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java?view=diff&rev=556344&r1=556343&r2=556344
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/IdeaModuleMojo.java Sat Jul 14 15:18:12 2007
@@ -569,7 +569,20 @@
                     resolveClassifier( createOrGetElement( lib, "SOURCES" ), a, sourceClassifier );
                 }
 
-                if ( downloadJavadocs )
+                if ( library != null && library.getSplitJavadocs().length > 0 )
+                {
+                    removeOldElements( lib, "JAVADOC" );
+                    Element javadocsElement = createElement( lib, "JAVADOC" );
+                    String[] javadocs = library.getSplitJavadocs();
+                    for ( int k = 0; k < javadocs.length; k++ )
+                    {
+                        String javadoc = javadocs[k];
+                        extractMacro( javadoc );
+                        Element sourceEl = createElement( javadocsElement, "root" );
+                        sourceEl.addAttribute( "url", javadoc );
+                    }
+                }
+                else if ( downloadJavadocs )
                 {
                     resolveClassifier( createOrGetElement( lib, "JAVADOC" ), a, javadocClassifier );
                 }

Modified: maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/Library.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/Library.java?view=diff&rev=556344&r1=556343&r2=556344
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/Library.java (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/main/java/org/apache/maven/plugin/idea/Library.java Sat Jul 14 15:18:12 2007
@@ -32,6 +32,8 @@
 
     private boolean exclude;
 
+    private String javadocs;
+
     public String getName()
     {
         return name;
@@ -90,6 +92,26 @@
     public void setClasses( String classes )
     {
         this.classes = classes;
+    }
+
+    public String getJavadocs()
+    {
+        return javadocs;
+    }
+
+    public void setJavadocs( String javadocs )
+    {
+        this.javadocs = javadocs;
+    }
+
+    public String[] getSplitJavadocs()
+    {
+        if ( javadocs == null )
+        {
+            return new String[0];
+        }
+
+        return javadocs.split( "[,\\s]+" );
     }
 
     public String toString()

Modified: maven/plugins/trunk/maven-idea-plugin/src/site/apt/examples/customize-libraries.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/site/apt/examples/customize-libraries.apt?view=diff&rev=556344&r1=556343&r2=556344
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/site/apt/examples/customize-libraries.apt (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/site/apt/examples/customize-libraries.apt Sat Jul 14 15:18:12 2007
@@ -1,5 +1,5 @@
  ------
- Customize the Project's Libraries
+ Customize Your Libraries
  ------
  Edwin Punzalan
  ------
@@ -24,7 +24,9 @@
 ~~ under the License.
 
 
-Customize the Project's Libraries
+Customize Your Libraries
+
+* Classes and sources
 
   If you do not want to use the packaged artifacts in your local repository and
   would want to use an alternate url, you can use:
@@ -57,8 +59,43 @@
 </project>
 +-----
 
-  Or to exclude a dependency from appearing on IntelliJ IDEA's list of
-  Libraries, you can do:
+* Javadocs
+
+  Sometimes the Javadocs for an artifact are only available online. You can use
+  these online Javadocs if you like. Just add the following to your plugin
+  configuration:
+
++-----
+<project>
+  [...]
+  <build>
+    [...]
+    <plugins>
+      [...]
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-idea-plugin</artifactId>
+        <configuration>
+          <libraries>
+            <library>
+              <name>servlet-api</name>
+              <javadocs>http://java.sun.com/javaee/5/docs/api/</javadocs>
+            </library>
+          </libraries>
+        </configuration>
+      </plugin>
+      [...]
+    </plugins>
+    [...]
+  </build>
+  [...]
+</project>
++-----
+
+* Exclude
+
+  To exclude a dependency from appearing in IntelliJ IDEA's list of
+  libraries, you can do:
 
 +-----
 <project>

Modified: maven/plugins/trunk/maven-idea-plugin/src/site/apt/library.apt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-idea-plugin/src/site/apt/library.apt?view=diff&rev=556344&r1=556343&r2=556344
==============================================================================
--- maven/plugins/trunk/maven-idea-plugin/src/site/apt/library.apt (original)
+++ maven/plugins/trunk/maven-idea-plugin/src/site/apt/library.apt Sat Jul 14 15:18:12 2007
@@ -24,29 +24,33 @@
 ~~ under the License.
 
 
-Defining Libraries Using the <<<Libraries>>> Parameter
+Defining Libraries Using the <<<libraries>>> Parameter
 
   You can control the libraries that are generated by
-  <<<maven-idea-plugin>>> with the use of the <<<library>>>
+  <<<maven-idea-plugin>>> with the use of the <<<libraries>>>
   parameter.
 
-  The <<<Library>>> Object can be defined with the following elements:
+  The <<<library>>> element can be defined with the following elements:
 
-  * <<<name>>> - The <<<artifactId>>> of the artifact that the
-  Library Object represents.
+  * <<<name>>> - The <<<artifactId>>> of the artifact that this
+  library represents.
 
-  * <<<classes>>> - When provided, replaces the jar package from the
+  * <<<classes>>> - When provided, replaces the <<<jar>>> package from the
   local repository. These can be comma-separated URLs pointing to the location
   of this artifact's class files.
 
+  * <<<javadocs>>> - When provided, replaces the <<<-javadoc>>> package from the
+  local repository. These can be comma-separated URLs pointing to the location
+  of this artifact's javadocs files.
+
   * <<<sources>>> - When provided, replaces the <<<-sources>>> package from the
   local repository. These can be comma-separated URLs pointing to the location
   of this artifact's source files.
 
-  * <<<exclude>>> - When set to <<<true>>>, makes the plugin ignore the artifact
+  * <<<exclude>>> - When set to <<<true>>>, makes the plugin ignore this artifact
   from its list of libraries.
 
   []
 
-  Examples on using the <<<Library>>> parameter can be found
+  Examples on using the <<<libraries>>> parameter can be found
   {{{examples/customize-libraries.html}here}}.