You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2007/05/09 14:14:54 UTC

svn commit: r536497 - in /maven/plugins/trunk/maven-javadoc-plugin: ./ src/it/ src/it/MJAVADOC-110/ src/it/MJAVADOC-110/test-module/ src/it/MJAVADOC-110/test-module/src/ src/it/MJAVADOC-110/test-module/src/main/ src/it/MJAVADOC-110/test-module/src/main...

Author: vsiveton
Date: Wed May  9 05:14:53 2007
New Revision: 536497

URL: http://svn.apache.org/viewvc?view=rev&rev=536497
Log:
MJAVADOC-110: sourcepath element is not working

o fixed getPackageNamesOrFilesWithUnnamedPackages() to handle this
o added IT test
o added IT profile in the pom.xml

Added:
    maven/plugins/trunk/maven-javadoc-plugin/src/it/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/pom.xml   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/pom.xml   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/main/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/main/java/
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/main/java/Test.java   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/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

Modified: maven/plugins/trunk/maven-javadoc-plugin/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/pom.xml?view=diff&rev=536497&r1=536496&r2=536497
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/pom.xml Wed May  9 05:14:53 2007
@@ -59,6 +59,21 @@
           <model>src/main/mdo/javadocOptions.mdo</model>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>src/it</directory>
+              <includes>
+                <include>**/target</include>
+                <include>**/build.log</include>
+              </includes>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <dependencies>
@@ -120,4 +135,67 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
+
+  <profiles>
+    <profile>
+      <id>integration-tests</id>
+      <activation>
+        <property>
+          <name>maven.test.skip</name>
+          <value>!true</value>
+        </property>
+      </activation>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-install-plugin</artifactId>
+            <version>2.2-SNAPSHOT</version>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <phase>pre-integration-test</phase>
+                <goals>
+                  <goal>install-file</goal>
+                </goals>
+                <configuration>
+                  <file>${project.build.directory}/${project.build.finalName}.jar</file>
+                  <groupId>${project.groupId}</groupId>
+                  <artifactId>${project.artifactId}</artifactId>
+                  <version>${project.version}</version>
+                  <packaging>${project.packaging}</packaging>
+                  <pomFile>${basedir}/pom.xml</pomFile>
+                  <createChecksum>true</createChecksum>
+                  <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+                  <localRepositoryId>it-local-repo</localRepositoryId>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <version>1.1-SNAPSHOT</version>
+            <configuration>
+              <projectsDirectory>src/it</projectsDirectory>
+              <pomIncludes>
+                <pomInclude>**/MJAVADOC-110/pom.xml</pomInclude>
+              </pomIncludes>
+              <postBuildHookScript>verify.bsh</postBuildHookScript>
+              <localRepositoryPath>${basedir}/target/local-repo</localRepositoryPath>
+            </configuration>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <phase>integration-test</phase>
+                <goals>
+                  <goal>run</goal>
+                </goals>
+              </execution>
+           </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 </project>

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/pom.xml?view=auto&rev=536497
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/pom.xml Wed May  9 05:14:53 2007
@@ -0,0 +1,62 @@
+<!--
+  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>
+  <groupId>test</groupId>
+  <artifactId>maven-javadoc-test</artifactId>
+  <packaging>pom</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>Maven Javadoc Test</name>
+  <modules>
+    <module>test-module</module>
+  </modules>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-javadoc-plugin</artifactId>
+          <version>2.3-SNAPSHOT</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>javadoc</id>
+            <phase>package</phase>
+            <goals>
+              <goal>javadoc</goal>
+            </goals>
+            <configuration>
+              <aggregate>false</aggregate>
+              <sourcepath>
+                test-module/src/main/java
+              </sourcepath>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file

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

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

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/pom.xml?view=auto&rev=536497
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/pom.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/pom.xml Wed May  9 05:14:53 2007
@@ -0,0 +1,34 @@
+<!--
+  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>maven-javadoc-test</artifactId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <groupId>test</groupId>
+  <artifactId>test-module</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>Test Module</name>
+</project>
\ No newline at end of file

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

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

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/main/java/Test.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/main/java/Test.java?view=auto&rev=536497
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/main/java/Test.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/main/java/Test.java Wed May  9 05:14:53 2007
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+/**
+ * Sample class inside the package to be included in the javadoc
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ */
+public class Test
+{
+    /**
+     * The main method
+     *
+     * @param args  an array of strings that contains the arguments
+     */
+    public static void main( String[] args )
+    {
+        System.out.println( "Sample Application." );
+    }
+
+    /**
+     * Sample method that prints out the parameter string.
+     *
+     * @param str   The string value to be printed.
+     */
+    protected void sampleMethod( String str )
+    {
+        System.out.println( str );
+    }
+}

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

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/test-module/src/main/java/Test.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/verify.bsh?view=auto&rev=536497
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/verify.bsh (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/it/MJAVADOC-110/verify.bsh Wed May  9 05:14:53 2007
@@ -0,0 +1,60 @@
+
+/*
+ * 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.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target file is missing or a directory." );
+        return false;
+    }
+
+    File apidocs = new File( basedir, "target/site/apidocs" );
+    if ( !apidocs.exists() || !apidocs.isDirectory() )
+    {
+        System.err.println( "target/site/apidocs file is missing or a directory." );
+        return false;
+    }
+
+    target = new File( basedir, "test-module/target" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "test-module/target file is missing or a directory." );
+        return false;
+    }
+    apidocs = new File( basedir, "test-module/target/site/apidocs" );
+    if ( !apidocs.exists() || !apidocs.isDirectory() )
+    {
+        System.err.println( "test-module/target/site/apidocs file is missing or a directory." );
+        return false;
+    }
+}
+catch( IOException e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;

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?view=diff&rev=536497&r1=536496&r2=536497
==============================================================================
--- 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 Wed May  9 05:14:53 2007
@@ -2461,7 +2461,7 @@
      * @param files
      * @return the list of package names for files in the sourcePaths
      */
-    private static List getPackageNames( List sourcePaths, List files )
+    private List getPackageNames( List sourcePaths, List files )
     {
         return getPackageNamesOrFilesWithUnnamedPackages( sourcePaths, files, true );
     }
@@ -2471,7 +2471,7 @@
      * @param files
      * @return a list files with unnamed package names for files in the sourecPaths
      */
-    private static List getFilesWithUnnamedPackages( List sourcePaths, List files )
+    private List getFilesWithUnnamedPackages( List sourcePaths, List files )
     {
         return getPackageNamesOrFilesWithUnnamedPackages( sourcePaths, files, false );
     }
@@ -2482,9 +2482,14 @@
      * @param onlyPackageName
      * @return a list of package names or files with unnamed package names, depending the value of the unnamed flag
      */
-    private static List getPackageNamesOrFilesWithUnnamedPackages( List sourcePaths, List files, boolean onlyPackageName )
+    private List getPackageNamesOrFilesWithUnnamedPackages( List sourcePaths, List files, boolean onlyPackageName )
     {
         List returnList = new ArrayList();
+
+        if ( !StringUtils.isEmpty( sourcepath ) )
+        {
+            return returnList;
+        }
 
         for ( Iterator it = files.iterator(); it.hasNext(); )
         {