Author: khmarbaise
Date: Sun Mar 15 18:32:20 2015
New Revision: 1666819

URL: http://svn.apache.org/r1666819
Log:
[MJAVADOC-414] Artifacts missing from test classpath.
 Patch of Michael Srb applied.

Added:
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/invoker.properties
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/pom.xml
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/main/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/main/java/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/main/java/mjavadoc414/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/main/java/mjavadoc414/App.java
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/java/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/java/mjavadoc414/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/java/mjavadoc414/test/
    
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/java/mjavadoc414/test/AppTest.java
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/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/java/org/apache/maven/plugin/javadoc/TestJavadocJar.java
    
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java
    
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestResourcesBundleMojo.java

Modified: maven/plugins/trunk/maven-javadoc-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/pom.xml?rev=1666819&r1=1666818&r2=1666819&view=diff
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/pom.xml Sun Mar 15 18:32:20 2015
@@ -402,6 +402,7 @@ under the License.
                 <pomInclude>MJAVADOC-365/pom.xml</pomInclude>
                 <pomInclude>MJAVADOC-369/pom.xml</pomInclude>
                 <pomInclude>MJAVADOC-407/pom.xml</pomInclude>
+                <pomInclude>MJAVADOC-414/pom.xml</pomInclude>
               </pomIncludes>
             </configuration>
           </plugin>

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/invoker.properties?rev=1666819&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/invoker.properties 
(added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/invoker.properties 
Sun Mar 15 18:32:20 2015
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals=clean javadoc:test-javadoc

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/pom.xml?rev=1666819&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/pom.xml Sun 
Mar 15 18:32:20 2015
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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/xsd/maven-4.0.0.xsd";>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+  <artifactId>mjavadoc-414</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <version>@pom.version@</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/main/java/mjavadoc414/App.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/main/java/mjavadoc414/App.java?rev=1666819&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/main/java/mjavadoc414/App.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/main/java/mjavadoc414/App.java
 Sun Mar 15 18:32:20 2015
@@ -0,0 +1,30 @@
+package mjavadoc414;
+
+/*
+ * 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.
+ */
+
+public class App
+{
+
+    public void method()
+    {
+        System.out.println( "method() called." );
+    }
+
+}

Added: 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/java/mjavadoc414/test/AppTest.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/java/mjavadoc414/test/AppTest.java?rev=1666819&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/java/mjavadoc414/test/AppTest.java
 (added)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/src/test/java/mjavadoc414/test/AppTest.java
 Sun Mar 15 18:32:20 2015
@@ -0,0 +1,43 @@
+package mjavadoc414.test;
+
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+import mjavadoc414.App;
+
+public class AppTest extends TestCase
+{
+
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * Tests {@link mjavadoc414.App}.
+     */
+    public void testApp()
+    {
+        new App().method();
+    }
+
+}

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/verify.bsh?rev=1666819&view=auto
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/verify.bsh 
(added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-414/verify.bsh Sun 
Mar 15 18:32:20 2015
@@ -0,0 +1,47 @@
+
+/*
+ * 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.*;
+import org.codehaus.plexus.util.*;
+
+File indexFile = new File( basedir, 
"target/site/testapidocs/mjavadoc414/test/AppTest.html" );
+
+if ( !indexFile.exists() )
+{
+    System.err.println( indexFile.getAbsolutePath() + " is missing." );
+    return false;
+}
+
+File buildLog = new File( basedir, "build.log" );
+String content = IOUtil.toString( new FileInputStream( buildLog ) );
+String importError = "error: cannot find symbol";
+if ( content.contains( importError ) )
+{
+    System.err.println( "build.log contains '" + importError + "'" );
+    return false;
+}
+
+String referenceWarning = "Tag @link: reference not found: mjavadoc414.App";
+if ( content.contains( referenceWarning ) )
+{
+    System.err.println( "build.log contains '" + referenceWarning + "'" );
+    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=1666819&r1=1666818&r2=1666819&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
 Sun Mar 15 18:32:20 2015
@@ -1752,6 +1752,16 @@ public abstract class AbstractJavadocMoj
     }
 
     /**
+     * Indicates whether this goal generates documentation for the <code>Java 
Test code</code>.
+     *
+     * @return <code>true</code> if the goal generates Test Javadocs, 
<code>false</code> otherwise.
+     */
+    protected boolean isTest()
+    {
+        return false;
+    }
+
+    /**
      * @return the output directory
      */
     protected String getOutputDirectory()
@@ -2499,6 +2509,11 @@ public abstract class AbstractJavadocMoj
         List<String> classpathElements = new ArrayList<String>();
         Map<String, Artifact> compileArtifactMap = new HashMap<String, 
Artifact>();
 
+        if ( isTest() )
+        {
+            classpathElements.addAll( getProjectBuildOutputDirs( project ) );
+        }
+
         populateCompileArtifactMap( compileArtifactMap, getProjectArtifacts( 
project ) );
 
         if ( isAggregator() && project.isExecutionRoot() )

Modified: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocJar.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocJar.java?rev=1666819&r1=1666818&r2=1666819&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocJar.java
 (original)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocJar.java
 Sun Mar 15 18:32:20 2015
@@ -220,4 +220,10 @@ public class TestJavadocJar
     {
         return super.configureDependencySourceResolution( config 
).withoutCompileSources().withTestSources();
     }
+
+    @Override
+    protected boolean isTest()
+    {
+        return true;
+    }
 }

Modified: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java?rev=1666819&r1=1666818&r2=1666819&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java
 (original)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestJavadocReport.java
 Sun Mar 15 18:32:20 2015
@@ -354,4 +354,10 @@ public class TestJavadocReport
     {
         return super.configureDependencySourceResolution( config 
).withoutCompileSources().withTestSources();
     }
+
+    @Override
+    protected boolean isTest()
+    {
+        return true;
+    }
 }

Modified: 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestResourcesBundleMojo.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestResourcesBundleMojo.java?rev=1666819&r1=1666818&r2=1666819&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestResourcesBundleMojo.java
 (original)
+++ 
maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/TestResourcesBundleMojo.java
 Sun Mar 15 18:32:20 2015
@@ -59,4 +59,9 @@ public class TestResourcesBundleMojo
         return testJavadocDirectory;
     }
 
+    @Override
+    protected boolean isTest()
+    {
+        return true;
+    }
 }


Reply via email to