Fix javadoc generation for gerrit extension and plugin API

It was a bad idea to use the maven-dependency-plugin to unpack the
sources for the javadoc generation as this plugin needs to download
the source artifact from a Maven repository. At this point in time the
source artifact only exists in the local target folder but is not yet
installed into a Maven repository. Instead we are now using the
maven-antrun-plugin to unzip the local source artifact.

Change-Id: I37a7f2e214a395f0c64fbe8001655ed842bab01f
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/gerrit-extension-api/pom.xml b/gerrit-extension-api/pom.xml
index 4c8d8de..cdab3ab 100644
--- a/gerrit-extension-api/pom.xml
+++ b/gerrit-extension-api/pom.xml
@@ -83,46 +83,39 @@
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <executions>
-            <execution>
-              <id>unpack-artifact-sources</id>
-              <phase>generate-resources</phase>
-              <goals>
-                <goal>unpack</goal>
-              </goals>
-              <configuration>
-                <artifactItems>
-                  <artifactItem>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>gerrit-extension-api</artifactId>
-                    <version>${project.version}</version>
-                    <classifier>all-sources</classifier>
-                    <overWrite>true</overWrite>
-                  </artifactItem>
-               </artifactItems>
-             <outputDirectory>${project.build.directory}/unpack_sources</outputDirectory>
-           </configuration>
-         </execution>
-       </executions>
-     </plugin>
-     <plugin>
-       <groupId>org.apache.maven.plugins</groupId>
-       <artifactId>maven-javadoc-plugin</artifactId>
-       <configuration>
-         <sourcepath>${project.build.directory}/unpack_sources</sourcepath>
-         <encoding>ISO-8859-1</encoding>
-         <quiet>true</quiet>
-         <detectOfflineLinks>false</detectOfflineLinks>
-       </configuration>
-       <executions>
-         <execution>
-           <goals>
-             <goal>jar</goal>
-           </goals>
-           <phase>process-resources</phase>
-         </execution>
-       </executions>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>unpack-sources</id>
+            <phase>package</phase>
+            <configuration>
+              <tasks>
+                <unzip src="${project.build.directory}/${project.artifactId}-${project.version}-all-sources.jar" dest="${project.build.directory}/unpack_sources" />
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <sourcepath>${project.build.directory}/unpack_sources</sourcepath>
+          <encoding>ISO-8859-1</encoding>
+          <quiet>true</quiet>
+          <detectOfflineLinks>false</detectOfflineLinks>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+            <phase>package</phase>
+          </execution>
+        </executions>
       </plugin>
     </plugins>
   </build>
diff --git a/gerrit-plugin-api/pom.xml b/gerrit-plugin-api/pom.xml
index 97b4eaa..6437674 100644
--- a/gerrit-plugin-api/pom.xml
+++ b/gerrit-plugin-api/pom.xml
@@ -119,47 +119,39 @@
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-dependency-plugin</artifactId>
-          <executions>
-            <execution>
-              <id>unpack-artifact-sources</id>
-              <phase>generate-resources</phase>
-              <goals>
-                <goal>unpack</goal>
-              </goals>
-              <configuration>
-                <artifactItems>
-                  <artifactItem>
-                    <groupId>${project.groupId}</groupId>
-                    <artifactId>gerrit-plugin-api</artifactId>
-                    <version>${project.version}</version>
-                    <classifier>sources</classifier>
-                    <overWrite>true</overWrite>
-                  </artifactItem>
-               </artifactItems>
-             <outputDirectory>${project.build.directory}/unpack_sources</outputDirectory>
-           </configuration>
-         </execution>
-       </executions>
-     </plugin>
-     <plugin>
-       <groupId>org.apache.maven.plugins</groupId>
-       <artifactId>maven-javadoc-plugin</artifactId>
-       <version>2.7</version>
-       <configuration>
-         <sourcepath>${project.build.directory}/unpack_sources</sourcepath>
-         <encoding>ISO-8859-1</encoding>
-         <quiet>true</quiet>
-         <detectOfflineLinks>false</detectOfflineLinks>
-       </configuration>
-       <executions>
-         <execution>
-           <goals>
-             <goal>jar</goal>
-           </goals>
-           <phase>process-resources</phase>
-         </execution>
-       </executions>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>unpack-sources</id>
+            <phase>package</phase>
+            <configuration>
+              <tasks>
+                <unzip src="${project.build.directory}/${project.artifactId}-${project.version}-sources.jar" dest="${project.build.directory}/unpack_sources" />
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <sourcepath>${project.build.directory}/unpack_sources</sourcepath>
+          <encoding>ISO-8859-1</encoding>
+          <quiet>true</quiet>
+          <detectOfflineLinks>false</detectOfflineLinks>
+        </configuration>
+        <executions>
+          <execution>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+            <phase>package</phase>
+          </execution>
+        </executions>
       </plugin>
     </plugins>
   </build>