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 2006/09/09 18:06:59 UTC

svn commit: r441808 - in /maven/plugins/trunk/maven-javadoc-plugin/src: main/java/org/apache/maven/plugin/javadoc/ test/java/org/apache/maven/plugin/javadoc/ test/java/org/apache/maven/plugin/javadoc/stubs/ test/resources/unit/jdk5-test/ test/resources...

Author: vsiveton
Date: Sat Sep  9 09:06:58 2006
New Revision: 441808

URL: http://svn.apache.org/viewvc?view=rev&rev=441808
Log:
MJAVADOC-65: The javadoc plugin seems to ignore package-info.java

o refactored to call "javadoc @options @packages" instead of "javadoc @options @files"
o handle package names and unnamed package
o handle @files or @argfile depending the jdk used (see javadoc Reference Guide)
o added test case for jdk 5

Added:
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/Jdk5TestMavenProjectStub.java   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5-test-plugin-config.xml   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/App.java   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/AppSample.java   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/MyAnnotationType.java   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/package-info.java   (with props)
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test2/
    maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test2/App2.java   (with props)
Modified:
    maven/plugins/trunk/maven-javadoc-plugin/src/main/java/org/apache/maven/plugin/javadoc/AbstractJavadocMojo.java
    maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java

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=441808&r1=441807&r2=441808
==============================================================================
--- 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 Sep  9 09:06:58 2006
@@ -918,6 +918,10 @@
 
         List files = getFiles( sourcePaths );
 
+        List packageNames = getPackageNames( sourcePaths, files );
+
+        List filesWithUnnamedPackages = getFilesWithUnnamedPackages( sourcePaths, files );
+
         if ( !canGenerateReport( files ) )
         {
             return;
@@ -926,28 +930,12 @@
         File javadocOutputDirectory = new File( getOutputDirectory() );
         javadocOutputDirectory.mkdirs();
 
-        if ( !files.isEmpty() )
-        {
-            File file = new File( javadocOutputDirectory, "files" );
-
-            if ( !debug )
-            {
-                file.deleteOnExit();
-            }
-
-            try
-            {
-                FileUtils.fileWrite( file.getAbsolutePath(), StringUtils.join( files.iterator(), "\n" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MavenReportException( "Unable to write temporary file for command execution", e );
-            }
-        }
+        // ----------------------------------------------------------------------
+        // Copy default resources
+        // ----------------------------------------------------------------------
 
         try
         {
-            // Copy default style sheet
             copyDefaultStylesheet( javadocOutputDirectory );
         }
         catch ( IOException e )
@@ -955,6 +943,10 @@
             throw new MavenReportException( "Unable to copy default stylesheet", e );
         }
 
+        // ----------------------------------------------------------------------
+        // Wrap javadoc options
+        // ----------------------------------------------------------------------
+
         StringBuffer options = new StringBuffer();
         if ( StringUtils.isNotEmpty( this.locale ) )
         {
@@ -970,6 +962,10 @@
             options.append( quotedPathArgument( classpath ) );
         }
 
+        // ----------------------------------------------------------------------
+        // Wrap javadoc arguments
+        // ----------------------------------------------------------------------
+
         Commandline cmd = new Commandline();
 
         // Set the proxy host and port
@@ -1028,7 +1024,10 @@
 
         addArgIfNotEmpty( arguments, "-exclude", getExcludedPackages( sourcePaths ), SINCE_JAVADOC_1_4 );
 
-        // javadoc arguments for default doclet
+        // ----------------------------------------------------------------------
+        // Wrap arguments for default doclet
+        // ----------------------------------------------------------------------
+
         if ( StringUtils.isEmpty( doclet ) )
         {
             addArgIf( arguments, author, "-author" );
@@ -1042,18 +1041,21 @@
             addArgIfNotEmpty( arguments, "-excludedocfilessubdir", quotedPathArgument( excludedocfilessubdir ),
                               SINCE_JAVADOC_1_4 );
             addArgIfNotEmpty( arguments, "-footer", quotedArgument( footer ) );
-            for ( int i = 0; i < groups.length; i++ )
+            if ( groups!= null )
             {
-                if ( groups[i] == null || StringUtils.isEmpty( groups[i].getTitle() )
-                    || StringUtils.isEmpty( groups[i].getPackages() ) )
-                {
-                    getLog().info( "A group option is empty. Ignore this option." );
-                }
-                else
+                for ( int i = 0; i < groups.length; i++ )
                 {
-                    String groupTitle = StringUtils.replace( groups[i].getTitle(), ",", "&#44;" );
-                    addArgIfNotEmpty( arguments, "-group", quotedArgument( groupTitle ) + " "
-                        + quotedArgument( groups[i].getPackages() ), true );
+                    if ( groups[i] == null || StringUtils.isEmpty( groups[i].getTitle() )
+                        || StringUtils.isEmpty( groups[i].getPackages() ) )
+                    {
+                        getLog().info( "A group option is empty. Ignore this option." );
+                    }
+                    else
+                    {
+                        String groupTitle = StringUtils.replace( groups[i].getTitle(), ",", "&#44;" );
+                        addArgIfNotEmpty( arguments, "-group", quotedArgument( groupTitle ) + " "
+                            + quotedArgument( groups[i].getPackages() ), true );
+                    }
                 }
             }
             addArgIfNotEmpty( arguments, "-header", quotedArgument( header ) );
@@ -1131,33 +1133,47 @@
             addArgIfNotEmpty( arguments, "-windowtitle", quotedArgument( windowtitle ) );
         }
 
+        // ----------------------------------------------------------------------
+        // Write options file and include it in the command line
+        // ----------------------------------------------------------------------
+
         if ( options.length() > 0 )
         {
-            File optionsFile = new File( javadocOutputDirectory, "options" );
-            for ( Iterator it = arguments.iterator(); it.hasNext(); )
-            {
-                options.append( " " );
-                options.append( (String) it.next() );
-            }
-            try
-            {
-                FileUtils.fileWrite( optionsFile.getAbsolutePath(), options.toString() );
-            }
-            catch ( IOException e )
+            addCommandLineOptions( cmd, options, arguments, javadocOutputDirectory );
+        }
+
+        // ----------------------------------------------------------------------
+        // Write packages file and include it in the command line
+        // ----------------------------------------------------------------------
+
+        if ( !packageNames.isEmpty() )
+        {
+            addCommandLinePackages( cmd, javadocOutputDirectory, packageNames );
+
+            // ----------------------------------------------------------------------
+            // Write argfile file and include it in the command line
+            // ----------------------------------------------------------------------
+
+            if ( !filesWithUnnamedPackages.isEmpty() )
             {
-                throw new MavenReportException( "Unable to write temporary file for command execution", e );
+                addCommandLineArgFile( cmd, javadocOutputDirectory, filesWithUnnamedPackages );
             }
-            cmd.createArgument().setValue( "@options" );
-            if ( !debug )
+        }
+        else
+        {
+            // ----------------------------------------------------------------------
+            // Write argfile file and include it in the command line
+            // ----------------------------------------------------------------------
+
+            if ( !files.isEmpty() )
             {
-                optionsFile.deleteOnExit();
+                addCommandLineArgFile( cmd, javadocOutputDirectory, files );
             }
         }
 
-        if ( !files.isEmpty() )
-        {
-            cmd.createArgument().setValue( "@files" );
-        }
+        // ----------------------------------------------------------------------
+        // Execute command line
+        // ----------------------------------------------------------------------
 
         getLog().debug( Commandline.toString( cmd.getCommandline() ) );
 
@@ -1176,7 +1192,10 @@
             throw new MavenReportException( "Unable to execute javadoc command", e );
         }
 
-        // Javadoc warnings
+        // ----------------------------------------------------------------------
+        // Handle Javadoc warnings
+        // ----------------------------------------------------------------------
+
         if ( StringUtils.isNotEmpty( err.getOutput() ) )
         {
             getLog().info( "Javadoc Warnings" );
@@ -1329,7 +1348,7 @@
      * @return a List of valid source directories
      */
     // TODO: could be better aligned with JXR, including getFiles() vs hasSources that finds java files.
-    private List pruneSourceDirs( List sourceDirs )
+    private static List pruneSourceDirs( List sourceDirs )
     {
         List pruned = new ArrayList( sourceDirs.size() );
         for ( Iterator i = sourceDirs.iterator(); i.hasNext(); )
@@ -1356,7 +1375,7 @@
      * @param excludedPackages the package names to be excluded in the javadoc
      * @return a List of the source files to be excluded in the generated javadoc
      */
-    private List getExcludedNames( List sourcePaths, String[] subpackagesList, String[] excludedPackages )
+    private static List getExcludedNames( List sourcePaths, String[] subpackagesList, String[] excludedPackages )
     {
         List excludedNames = new ArrayList();
         for ( Iterator i = sourcePaths.iterator(); i.hasNext(); )
@@ -1450,7 +1469,7 @@
      * @param artifacts
      * @return
      */
-    private List getCompileArtifacts( Set artifacts )
+    private static List getCompileArtifacts( Set artifacts )
     {
         List list = new ArrayList( artifacts.size() );
 
@@ -1946,7 +1965,7 @@
      * @param value the argument value.
      * @return argument with quote
      */
-    private String quotedArgument( String value )
+    private static String quotedArgument( String value )
     {
         String arg = value;
         if ( StringUtils.isNotEmpty( arg ) )
@@ -1968,7 +1987,7 @@
      * @param value the argument value.
      * @return path argument with quote
      */
-    private String quotedPathArgument( String value )
+    private static String quotedPathArgument( String value )
     {
         String path = value;
 
@@ -2112,7 +2131,7 @@
      * @param excludePackages package names to be excluded in the javadoc
      * @return a StringBuffer that contains the appended file names of the files to be included in the javadoc
      */
-    private List getIncludedFiles( String sourceDirectory, String[] fileList, String[] excludePackages )
+    private static List getIncludedFiles( String sourceDirectory, String[] fileList, String[] excludePackages )
     {
         List files = new ArrayList();
 
@@ -2179,7 +2198,7 @@
      * @param excludePackagenames package names to be excluded in the javadoc
      * @return a List of the packagenames to be excluded
      */
-    private List getExcludedPackages( String sourceDirectory, String[] excludePackagenames )
+    private static List getExcludedPackages( String sourceDirectory, String[] excludePackagenames )
     {
         List files = new ArrayList();
         for ( int i = 0; i < excludePackagenames.length; i++ )
@@ -2227,13 +2246,213 @@
      * @param files           the variable that contains the appended filenames of the files to be included in the javadoc
      * @param excludePackages the packages to be excluded in the javadocs
      */
-    private void addFilesFromSource( List files, String sourceDirectory, String[] excludePackages )
+    private static void addFilesFromSource( List files, String sourceDirectory, String[] excludePackages )
     {
         String[] fileList = FileUtils.getFilesFromExtension( sourceDirectory, new String[] { "java" } );
         if ( fileList != null && fileList.length != 0 )
         {
             List tmpFiles = getIncludedFiles( sourceDirectory, fileList, excludePackages );
             files.addAll( tmpFiles );
+        }
+    }
+
+    /**
+     * @param sourcePaths
+     * @param files
+     * @return the list of package names for files in the sourcePaths
+     */
+    private static List getPackageNames( List sourcePaths, List files )
+    {
+        return getPackageNamesOrFilesWithUnnamedPackages( sourcePaths, files, true );
+    }
+
+    /**
+     * @param sourcePaths
+     * @param files
+     * @return a list files with unnamed package names for files in the sourecPaths
+     */
+    private static List getFilesWithUnnamedPackages( List sourcePaths, List files )
+    {
+        return getPackageNamesOrFilesWithUnnamedPackages( sourcePaths, files, false );
+    }
+
+    /**
+     * @param sourcePaths
+     * @param files
+     * @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 )
+    {
+        List returnList = new ArrayList();
+
+        for ( Iterator it = files.iterator(); it.hasNext(); )
+        {
+            String currentFile = (String) it.next();
+            currentFile = currentFile.replace( '\\', '/' );
+
+            for ( Iterator it2 = sourcePaths.iterator(); it2.hasNext(); )
+            {
+                String currentSourcePath = (String) it2.next();
+                currentSourcePath = currentSourcePath.replace( '\\', '/' );
+
+                if ( !currentSourcePath.endsWith( "/" ) )
+                {
+                    currentSourcePath += "/";
+                }
+
+                if ( currentFile.indexOf( currentSourcePath ) != -1 )
+                {
+                    String packagename = currentFile.substring( currentSourcePath.length() + 1 );
+                    if ( onlyPackageName && packagename.lastIndexOf( "/" ) != -1 )
+                    {
+                        packagename = packagename.substring( 0, packagename.lastIndexOf( "/" ) );
+                        packagename = packagename.replace( '/', '.' );
+
+                        if ( !returnList.contains( packagename ) )
+                        {
+                            returnList.add( packagename );
+                        }
+                    }
+                    if ( !onlyPackageName && packagename.lastIndexOf( "/" ) == -1 )
+                    {
+                        returnList.add( currentFile );
+                    }
+                }
+            }
+        }
+
+        return returnList;
+    }
+
+    /**
+     * Generate an "options" file for all options and arguments and add the "@options" in the command line.
+     *
+     * @see <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#argumentfiles">
+     * Reference Guide, Command line argument files
+     * </a>
+     *
+     * @param cmd
+     * @param options
+     * @param arguments
+     * @param javadocOutputDirectory
+     * @throws MavenReportException if any
+     */
+    private void addCommandLineOptions( Commandline cmd, StringBuffer options, List arguments,
+                                       File javadocOutputDirectory )
+        throws MavenReportException
+    {
+        File optionsFile = new File( javadocOutputDirectory, "options" );
+
+        options.append( " " );
+        options.append( StringUtils.join( arguments.toArray( new String[0] ), SystemUtils.LINE_SEPARATOR ) );
+
+        try
+        {
+            FileUtils.fileWrite( optionsFile.getAbsolutePath(), options.toString() );
+        }
+        catch ( IOException e )
+        {
+            throw new MavenReportException( "Unable to write '" + optionsFile.getName()
+                + "' temporary file for command execution", e );
+        }
+
+        cmd.createArgument().setValue( "@options" );
+
+        if ( !debug )
+        {
+            optionsFile.deleteOnExit();
+        }
+    }
+
+    /**
+     * Generate a file called "argfile" (or "files", depending the JDK) to hold files and add the "@argfile"
+     * (or "@file", depending the JDK) in the command line.
+     *
+     * @see <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#argumentfiles">
+     * Reference Guide, Command line argument files
+     * </a>
+     * @see <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/javadoc/whatsnew-1.4.html#runningjavadoc">
+     * What s New in Javadoc 1.4
+     * </a>
+     *
+     * @param cmd
+     * @param javadocOutputDirectory
+     * @param files
+     * @throws MavenReportException if any
+     */
+    private void addCommandLineArgFile( Commandline cmd, File javadocOutputDirectory, List files )
+        throws MavenReportException
+    {
+        File argfileFile;
+        if ( SystemUtils.isJavaVersionAtLeast( SINCE_JAVADOC_1_4 ) )
+        {
+            argfileFile = new File( javadocOutputDirectory, "argfile" );
+        }
+        else
+        {
+            argfileFile = new File( javadocOutputDirectory, "files" );
+        }
+
+        try
+        {
+            FileUtils.fileWrite( argfileFile.getAbsolutePath(), StringUtils.join( files.iterator(),
+                                                                                  SystemUtils.LINE_SEPARATOR ) );
+        }
+        catch ( IOException e )
+        {
+            throw new MavenReportException( "Unable to write '" + argfileFile.getName()
+                + "' temporary file for command execution", e );
+        }
+
+        if ( SystemUtils.isJavaVersionAtLeast( SINCE_JAVADOC_1_4 ) )
+        {
+            cmd.createArgument().setValue( "@argfile" );
+        }
+        else
+        {
+            cmd.createArgument().setValue( "@files" );
+        }
+
+        if ( !debug )
+        {
+            argfileFile.deleteOnExit();
+        }
+    }
+
+    /**
+     * Generate a file called "packages" to hold all package namesand add the "@packages" in the command line.
+     *
+     * @see <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#argumentfiles">
+     * Reference Guide, Command line argument files
+     * </a>
+     *
+     * @param cmd
+     * @param javadocOutputDirectory
+     * @param packageNames
+     * @throws MavenReportException if any
+     */
+    private void addCommandLinePackages( Commandline cmd, File javadocOutputDirectory, List packageNames )
+        throws MavenReportException
+    {
+        File packagesFile = new File( javadocOutputDirectory, "packages" );
+
+        try
+        {
+            FileUtils.fileWrite( packagesFile.getAbsolutePath(), StringUtils
+                .join( packageNames.toArray( new String[0] ), SystemUtils.LINE_SEPARATOR ) );
+        }
+        catch ( IOException e )
+        {
+            throw new MavenReportException( "Unable to write '" + packagesFile.getName()
+                + "' temporary file for command execution", e );
+        }
+
+        cmd.createArgument().setValue( "@packages" );
+
+        if ( !debug )
+        {
+            packagesFile.deleteOnExit();
         }
     }
 }

Modified: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java?view=diff&rev=441808&r1=441807&r2=441808
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java (original)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/JavadocReportTest.java Sat Sep  9 09:06:58 2006
@@ -16,6 +16,7 @@
  * limitations under the License.
  */
 
+import org.apache.commons.lang.SystemUtils;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -548,7 +549,6 @@
         return str;
     }
 
-
     /**
      * Method to test the taglet artifact configuration
      *
@@ -566,12 +566,46 @@
         JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
         mojo.execute();
 
-        File generatedFile = new File( getBasedir(), "target/test/unit/taglet-test/target/site/apidocs/index.html" );
-        assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
+        File index = new File( getBasedir(), "target/test/unit/taglet-test/target/site/apidocs/index.html" );
+        assertTrue( FileUtils.fileExists( index.getAbsolutePath() ) );
 
         File appFile = new File( getBasedir(), "target/test/unit/taglet-test/target/site/apidocs/taglet/test/App.html" );
         assertTrue( appFile.exists() );
         String appString = readFile( appFile );
         assertTrue( appString.indexOf( "<b>To Do:</b>" ) != -1 );
+    }
+
+    /**
+     * Method to test the jdk5 javadoc
+     *
+     * @throws Exception
+     */
+    public void testJdk5()
+        throws Exception
+    {
+        if ( !SystemUtils.isJavaVersionAtLeast( 1.5f ) )
+        {
+            getContainer().getLogger().warn( "JdkDK 5.0 or more is required to run javadoc for " +
+                    "'org.apache.maven.plugin.javadoc.JavadocReportTest#testJdk5()'." );
+            return;
+        }
+
+        File testPom = new File( getBasedir(),
+                                 "src/test/resources/unit/jdk5-test/jdk5-test-plugin-config.xml" );
+        JavadocReport mojo = (JavadocReport) lookupMojo( "javadoc", testPom );
+        mojo.execute();
+
+        File index = new File( getBasedir(), "target/test/unit/jdk5-test/target/site/apidocs/index.html" );
+        assertTrue( FileUtils.fileExists( index.getAbsolutePath() ) );
+
+        File overviewSummary = new File( getBasedir(), "target/test/unit/jdk5-test/target/site/apidocs/overview-summary.html" );
+        assertTrue( FileUtils.fileExists( overviewSummary.getAbsolutePath() ) );
+        String readed = readFile( overviewSummary );
+        assertTrue( readed.indexOf( "<b>Test the package-info</b>" ) != -1 );
+
+        File packageSummary = new File( getBasedir(), "target/test/unit/jdk5-test/target/site/apidocs/jdk5/test/package-summary.html" );
+        assertTrue( FileUtils.fileExists( packageSummary.getAbsolutePath() ) );
+        readed = readFile( packageSummary );
+        assertTrue( readed.indexOf( "<b>Test the package-info</b>" ) != -1 );
     }
 }

Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/Jdk5TestMavenProjectStub.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/Jdk5TestMavenProjectStub.java?view=auto&rev=441808
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/Jdk5TestMavenProjectStub.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/Jdk5TestMavenProjectStub.java Sat Sep  9 09:06:58 2006
@@ -0,0 +1,97 @@
+package org.apache.maven.plugin.javadoc.stubs;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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 org.apache.maven.model.Build;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Scm;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ */
+public class Jdk5TestMavenProjectStub
+    extends MavenProjectStub
+{
+    private Scm scm;
+
+    private Build build;
+
+    public Jdk5TestMavenProjectStub()
+    {
+        MavenXpp3Reader pomReader = new MavenXpp3Reader();
+        Model model = null;
+
+        try
+        {
+            model = pomReader.read( new FileReader( new File( getBasedir()
+                + "/src/test/resources/unit/jdk5-test/jdk5-test-plugin-config.xml" ) ) );
+            setModel( model );
+        }
+        catch ( Exception e )
+        {
+            throw new RuntimeException( e );
+        }
+
+        setGroupId( model.getGroupId() );
+        setArtifactId( model.getArtifactId() );
+        setVersion( model.getVersion() );
+        setName( model.getName() );
+        setUrl( model.getUrl() );
+        setPackaging( model.getPackaging() );
+
+        Scm scm = new Scm();
+        scm.setConnection( "scm:svn:http://svn.apache.org/maven/sample/trunk" );
+        setScm( scm );
+
+        Build build = new Build();
+        build.setFinalName( model.getArtifactId() );
+        build.setDirectory( getBasedir() + "/target/test/unit/jdk5-test/target" );
+        setBuild( build );
+
+        String basedir = getBasedir().getAbsolutePath();
+        List compileSourceRoots = new ArrayList();
+        compileSourceRoots.add( basedir + "/src/test/resources/unit/jdk5-test/" );
+        setCompileSourceRoots( compileSourceRoots );
+    }
+
+    public Scm getScm()
+    {
+        return scm;
+    }
+
+    public void setScm( Scm scm )
+    {
+        this.scm = scm;
+    }
+
+    public Build getBuild()
+    {
+        return build;
+    }
+
+    public void setBuild( Build build )
+    {
+        this.build = build;
+    }
+}

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/Jdk5TestMavenProjectStub.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/java/org/apache/maven/plugin/javadoc/stubs/Jdk5TestMavenProjectStub.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5-test-plugin-config.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5-test-plugin-config.xml?view=auto&rev=441808
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5-test-plugin-config.xml (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5-test-plugin-config.xml Sat Sep  9 09:06:58 2006
@@ -0,0 +1,25 @@
+<project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>jdk5.test</groupId>
+  <artifactId>jdk5-test</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <inceptionYear>2006</inceptionYear>
+  <name>Maven Javadoc Plugin jdk5 Test</name>
+  <url>http://maven.apache.org</url>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <project implementation="org.apache.maven.plugin.javadoc.stubs.Jdk5TestMavenProjectStub"/>
+          <localRepository>${localRepository}</localRepository>
+          <outputDirectory>${basedir}/target/test/unit/jdk5-test/target/site/apidocs</outputDirectory>
+          <source>1.5</source>
+          <windowtitle>Maven Javadoc Plugin Taglet jdk5 1.0-SNAPSHOT API</windowtitle>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5-test-plugin-config.xml
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/App.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/App.java?view=auto&rev=441808
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/App.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/App.java Sat Sep  9 09:06:58 2006
@@ -0,0 +1,45 @@
+package jdk5.test;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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 App
+{
+    /**
+     * 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/test/resources/unit/jdk5-test/jdk5/test/App.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/App.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/AppSample.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/AppSample.java?view=auto&rev=441808
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/AppSample.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/AppSample.java Sat Sep  9 09:06:58 2006
@@ -0,0 +1,75 @@
+package jdk5.test;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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;
+import java.io.IOException;
+
+/**
+ * Sample class inside the package to be included in the javadoc
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ */
+public class AppSample
+{
+    /**
+     * Contains the file to be set
+     */
+    protected File file;
+
+    /**
+     * The main method
+     *
+     * @param args  an array of strings that contains the arguments
+     */
+    public static void main( String[] args )
+    {
+        System.out.println( "Another Sample Application" );
+    }
+
+    /**
+     * Setter method for variable file
+     *
+     * @param file the value to be set
+     */
+    public void setFile( File file )
+    {
+        this.file = file;
+    }
+
+    /**
+     * Getter method for variable file
+     *
+     * @return a File object
+     */
+    public File getFile()
+    {
+        return file;
+    }
+
+    /**
+     * Create new file
+     *
+     * @throws java.io.IOException  thrown if an I/O error occurred during file creation
+     */
+    public void createFile()
+        throws IOException
+    {
+        File f = new File( file.getAbsolutePath() );
+        f.createNewFile();
+    }
+}

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/AppSample.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/AppSample.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/MyAnnotationType.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/MyAnnotationType.java?view=auto&rev=441808
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/MyAnnotationType.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/MyAnnotationType.java Sat Sep  9 09:06:58 2006
@@ -0,0 +1,32 @@
+package jdk5.test;
+
+/*
+ * Copyright 2001-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * Sample annotation type
+ *
+ * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
+ */
+@Retention(RUNTIME)
+public @interface MyAnnotationType 
+{
+    public String value();
+}

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/MyAnnotationType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/MyAnnotationType.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/package-info.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/package-info.java?view=auto&rev=441808
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/package-info.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/package-info.java Sat Sep  9 09:06:58 2006
@@ -0,0 +1,4 @@
+/**
+ * <b>Test the package-info</b>
+ */
+package jdk5.test;

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test/package-info.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test2/App2.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test2/App2.java?view=auto&rev=441808
==============================================================================
--- maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test2/App2.java (added)
+++ maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test2/App2.java Sat Sep  9 09:06:58 2006
@@ -0,0 +1,45 @@
+package jdk5.test2;
+
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed 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 App2
+{
+    /**
+     * 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/test/resources/unit/jdk5-test/jdk5/test2/App2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-javadoc-plugin/src/test/resources/unit/jdk5-test/jdk5/test2/App2.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"