Author: vsiveton
Date: Sat May 31 03:53:58 2008
New Revision: 661997

URL: http://svn.apache.org/viewvc?rev=661997&view=rev
Log:
MJAVADOC-126: Add the ability to load the stylesheet from a jar (resource)
Submitted by: Francois Fernandes
Reviewed by: Vincent Siveton

o patch ant IT applied

Added:
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/goals.txt   
(with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/pom.xml   
(with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/   (with 
props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/pom.xml   
(with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/src/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/src/main/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/src/main/resources/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/src/main/resources/file1.txt
   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/   (with 
props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/pom.xml   
(with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/src/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/src/main/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/src/main/resources/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/src/main/resources/file2.txt
   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/   (with 
props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/pom.xml   
(with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/test/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/test/TestClass.java
   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/verify.bsh
Modified:
    maven/plugins/trunk/maven-javadoc-plugin/pom.xml
    
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
    maven/plugins/trunk/maven-javadoc-plugin/src/main/mdo/javadocOptions.mdo

Modified: maven/plugins/trunk/maven-javadoc-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/pom.xml?rev=661997&r1=661996&r2=661997&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/pom.xml Sat May 31 03:53:58 2008
@@ -259,6 +259,7 @@
               <projectsDirectory>src/it</projectsDirectory>
               <pomIncludes>
                 <pomInclude>**/MJAVADOC-110/pom.xml</pomInclude>
+                <pomInclude>**/MJAVADOC-126/pom.xml</pomInclude>
                 <pomInclude>**/MJAVADOC-137/pom.xml</pomInclude>
                 <pomInclude>**/MJAVADOC-172/pom.xml</pomInclude>
                 <pomInclude>**/MJAVADOC-180/pom.xml</pomInclude>

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May 31 03:53:58 2008
@@ -0,0 +1 @@
+build.log

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/goals.txt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/goals.txt?rev=661997&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/goals.txt 
(added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/goals.txt Sat 
May 31 03:53:58 2008
@@ -0,0 +1 @@
+install
\ No newline at end of file

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/goals.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/goals.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/pom.xml?rev=661997&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/pom.xml Sat 
May 31 03:53:58 2008
@@ -0,0 +1,26 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>test</groupId>
+       <artifactId>parent</artifactId>
+       <packaging>pom</packaging>
+       <version>1.0-SNAPSHOT</version>
+       <name>Maven Javadoc Test</name>
+       <build>
+               <pluginManagement>
+                       <plugins>
+                               <plugin>
+                                       
<artifactId>maven-javadoc-plugin</artifactId>
+                                       <version>@pom.version@</version>
+                               </plugin>
+                       </plugins>
+               </pluginManagement>
+       </build>
+       <modules>
+               <module>res1</module>
+               <module>res2</module>
+               <module>test</module>
+       </modules>
+
+</project>
\ No newline at end of file

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May 31 03:53:58 2008
@@ -0,0 +1 @@
+target

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/pom.xml?rev=661997&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/pom.xml 
(added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/pom.xml 
Sat May 31 03:53:58 2008
@@ -0,0 +1,14 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>test</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+       
+  <artifactId>res1</artifactId>
+  <packaging>jar</packaging>
+  <name>Resource jar 1</name>
+</project>
\ No newline at end of file

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/src/main/resources/file1.txt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/src/main/resources/file1.txt?rev=661997&view=auto
==============================================================================
    (empty)

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/src/main/resources/file1.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res1/src/main/resources/file1.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May 31 03:53:58 2008
@@ -0,0 +1 @@
+target

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/pom.xml?rev=661997&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/pom.xml 
(added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/pom.xml 
Sat May 31 03:53:58 2008
@@ -0,0 +1,14 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>test</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+       
+  <artifactId>res2</artifactId>
+  <packaging>jar</packaging>
+  <name>Resource jar 2</name>
+</project>
\ No newline at end of file

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/src/main/resources/file2.txt
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/src/main/resources/file2.txt?rev=661997&view=auto
==============================================================================
    (empty)

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/src/main/resources/file2.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/res2/src/main/resources/file2.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat May 31 03:53:58 2008
@@ -0,0 +1 @@
+target

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/pom.xml?rev=661997&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/pom.xml 
(added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/pom.xml 
Sat May 31 03:53:58 2008
@@ -0,0 +1,65 @@
+<!--
+       Licensed to the Apache Software Foundation (ASF) under one
+       or more contributor license agreements.  See the NOTICE file
+       distributed with this work for additional information
+       regarding copyright ownership.  The ASF licenses this file
+       to you 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 xmlns="http://maven.apache.org/POM/4.0.0";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+       <modelVersion>4.0.0</modelVersion>
+       <parent>
+               <groupId>test</groupId>
+               <artifactId>parent</artifactId>
+               <version>1.0-SNAPSHOT</version>
+       </parent>
+       
+       <artifactId>test</artifactId>
+       <packaging>jar</packaging>
+       <build>
+               <plugins>
+                       <plugin>
+                               <artifactId>maven-javadoc-plugin</artifactId>
+                               <configuration>
+                                       <debug>true</debug>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <id>javadoc</id>
+                                               <phase>package</phase>
+                                               <goals>
+                                                       <goal>javadoc</goal>
+                                               </goals>
+                                               <configuration>
+                                                       <resourcesArtifacts>
+                                                               
<resourcesArtifact>
+                                                                       
<groupId>${project.groupId}</groupId>
+                                                                       
<artifactId>res1</artifactId>
+                                                                       
<version>1.0-SNAPSHOT</version>
+                                                               
</resourcesArtifact>
+                                                               
<resourcesArtifact>
+                                                                       
<groupId>${project.groupId}</groupId>
+                                                                       
<artifactId>res2</artifactId>
+                                                                       
<version>1.0-SNAPSHOT</version>
+                                                               
</resourcesArtifact>
+                                                       </resourcesArtifacts>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+</project>
\ No newline at end of file

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/test/TestClass.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/test/TestClass.java?rev=661997&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/test/TestClass.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/test/TestClass.java
 Sat May 31 03:53:58 2008
@@ -0,0 +1,9 @@
+package test;
+
+/**
+ * this is a simple test class
+ */
+public class TestClass
+{
+
+}

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/test/TestClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/test/src/main/java/test/TestClass.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/verify.bsh?rev=661997&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/verify.bsh 
(added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-126/verify.bsh Sat 
May 31 03:53:58 2008
@@ -0,0 +1,51 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.*;
+
+File target = new File( basedir, "test/target" );
+if ( !target.exists() || !target.isDirectory() )
+{
+    System.err.println( "target is missing or not a directory." );
+    return false;
+}
+
+File apidocs = new File( basedir, "test/target/site/apidocs" );
+if ( !apidocs.exists() || !apidocs.isDirectory() )
+{
+    System.err.println( apidocs.getAbsolutePath() + " is missing or not a 
directory." );
+    return false;
+}
+
+File file1 = new File( apidocs, "file1.txt" );
+if ( !file1.exists() || !file1.isFile() )
+{
+    System.err.println( file1.getAbsolutePath() + " is missing or a 
directory." );
+    return false;
+}
+
+File file2 = new File( apidocs, "file2.txt" );
+if ( !file2.exists() || !file2.isFile() )
+{
+    System.err.println( file2.getAbsolutePath() + " is missing or a 
directory." );
+    return false;
+}
+
+return true;

Modified: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java?rev=661997&r1=661996&r2=661997&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
 Sat May 31 03:53:58 2008
@@ -56,10 +56,12 @@
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.DefaultPluginManager;
 import org.apache.maven.plugin.javadoc.options.DocletArtifact;
 import org.apache.maven.plugin.javadoc.options.Group;
 import org.apache.maven.plugin.javadoc.options.JavadocPathArtifact;
 import org.apache.maven.plugin.javadoc.options.OfflineLink;
+import org.apache.maven.plugin.javadoc.options.ResourcesArtifact;
 import org.apache.maven.plugin.javadoc.options.Tag;
 import org.apache.maven.plugin.javadoc.options.Taglet;
 import org.apache.maven.plugin.javadoc.options.TagletArtifact;
@@ -73,6 +75,9 @@
 import org.apache.maven.toolchain.Toolchain;
 import org.apache.maven.toolchain.ToolchainManager;
 import org.apache.maven.wagon.PathUtils;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
 import 
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
@@ -219,6 +224,25 @@
     private ArtifactResolver resolver;
 
     /**
+     * A list of artifacts containing resources which sould be copied into the
+     * javadoc output directory (like stylesheets, icons, etc.).
+     * <br/>
+     * Example:
+     * <pre>
+     * &lt;resourcesArtifacts&gt;<br/>
+     *   &lt;resourcesArtifact&gt;<br/>
+     *     &lt;groupId&gt;external.group.id&lt;/groupId&gt;<br/>
+     *     &lt;artifactId&gt;external-resources&lt;/artifactId&gt;<br/>
+     *     &lt;version&gt;1.0&lt;/version&gt;<br/>
+     *   &lt;/resourcesArtifact&gt;<br/>
+     *  &lt;/resourcesArtifacts&gt;
+     * </pre>
+     *
+     * @parameter expression="${resourcesArtifacts}"
+     */
+    private ResourcesArtifact[] resourcesArtifacts;
+
+    /**
      * Factory for creating artifact objects
      *
      * @component
@@ -1071,6 +1095,12 @@
      */
     private String windowtitle;
 
+    /**
+     * @component
+     */
+    private ArchiverManager archiverManager;
+
+
     // ----------------------------------------------------------------------
     // protected methods
     // ----------------------------------------------------------------------
@@ -1316,6 +1346,62 @@
         }
 
         // 
----------------------------------------------------------------------
+        // Copy additional javadoc resources in artifacts
+        // 
----------------------------------------------------------------------
+        if ( resourcesArtifacts != null && resourcesArtifacts.length > 0 )
+        {
+
+            File target = javadocOutputDirectory;
+
+            UnArchiver unArchiver;
+            try
+            {
+                unArchiver = archiverManager.getUnArchiver( "jar" );
+            }
+            catch ( NoSuchArchiverException e )
+            {
+                throw new MavenReportException( "Unable to extract resources 
artifact. No archiver for 'jar' available.", e );
+            }
+
+            for ( int i = 0; i < resourcesArtifacts.length; i++ )
+            {
+                ResourcesArtifact item = resourcesArtifacts[i];
+
+                Artifact artifact;
+
+                try
+                {
+                    artifact = createAndResolveArtifact( item );
+                }
+                catch ( ArtifactResolutionException e )
+                {
+                    throw new MavenReportException( "Unable to resolve 
artifact:" + item, e );
+                }
+                catch ( ArtifactNotFoundException e )
+                {
+                    throw new MavenReportException( "Unable to find artifact:" 
+ item, e );
+                }
+
+                unArchiver.setSourceFile( artifact.getFile() );
+                unArchiver.setDestDirectory( target );
+
+                getLog().info(
+                               "extracting contents of resources artifact: " + 
item.getGroupId() + ":"
+                                   + item.getArtifactId() + ":" + 
item.getVersion() );
+                try
+                {
+                    unArchiver.extract();
+                }
+                catch ( Exception e )
+                {
+                    throw new MavenReportException( "extraction of resources 
failed. Artifact that failed was: "
+                        + item, e );
+                }
+            }
+        }
+
+
+        // 
----------------------------------------------------------------------
         // Wrap javadoc options
         // 
----------------------------------------------------------------------
 
@@ -2291,13 +2377,10 @@
 
         List path = new ArrayList();
 
-        Artifact artifact = factory.createArtifact( 
javadocArtifact.getGroupId(), javadocArtifact.getArtifactId(),
-                                                    
javadocArtifact.getVersion(), Artifact.SCOPE_COMPILE, "jar" );
 
         try
         {
-            // Find the Javadoc Artifact in the local repo
-            resolver.resolve( artifact, remoteRepositories, localRepository );
+            Artifact artifact = createAndResolveArtifact( javadocArtifact );
             path.add( artifact.getFile().getAbsolutePath() );
 
             // Find its transitive dependencies in the local repo
@@ -2344,6 +2427,24 @@
     }
 
     /**
+     * creates an [EMAIL PROTECTED] Artifact} representing the configured 
[EMAIL PROTECTED] JavadocPathArtifact} and resolves it.
+     *
+     * @param javadocArtifact the [EMAIL PROTECTED] JavadocPathArtifact} to 
resolve
+     * @return a resolved [EMAIL PROTECTED] Artifact}
+     * @throws ArtifactResolutionException if the resolution of the artifact 
failed.
+     * @throws ArtifactNotFoundException if the artifact hasn't been found.
+     */
+    private Artifact createAndResolveArtifact( JavadocPathArtifact 
javadocArtifact )
+        throws ArtifactResolutionException, ArtifactNotFoundException
+    {
+        Artifact artifact = factory.createArtifact( 
javadocArtifact.getGroupId(), javadocArtifact.getArtifactId(),
+                                                    
javadocArtifact.getVersion(), Artifact.SCOPE_COMPILE, "jar" );
+        // Find the Javadoc Artifact in the local repo
+        resolver.resolve( artifact, remoteRepositories, localRepository );
+        return artifact;
+    }
+
+    /**
      * Method that adds/sets the java memory parameters in the command line 
execution.
      *
      * @param cmd    the command line execution object where the argument will 
be added

Modified: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/mdo/javadocOptions.mdo
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/mdo/javadocOptions.mdo?rev=661997&r1=661996&r2=661997&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/main/mdo/javadocOptions.mdo 
(original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/main/mdo/javadocOptions.mdo 
Sat May 31 03:53:58 2008
@@ -178,6 +178,13 @@
     </class>
 
     <class>
+      <name>ResourcesArtifact</name>
+      <description>A artifact containing resources.</description>
+      <version>1.0.0</version>
+      <superClass>JavadocPathArtifact</superClass>
+    </class>
+
+    <class>
       <name>Taglet</name>
       <description>A Taglet parameter.</description>
       <version>1.0.0</version>
@@ -231,3 +238,4 @@
   </classes>
 </model>
 
+


Reply via email to