Fix MNG-873

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@280592 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2005-09-13 17:06:14 +00:00
parent 5777c1ac9f
commit 4bbf7a627c
1 changed files with 18 additions and 22 deletions

View File

@ -74,9 +74,6 @@ public class JavadocReport
/** Default bottom */ /** Default bottom */
private static final String DEFAULT_BOTTOM = "Copyright ${project.inceptionYear-currentYear} ${project.organization.name}. All Rights Reserved."; private static final String DEFAULT_BOTTOM = "Copyright ${project.inceptionYear-currentYear} ${project.organization.name}. All Rights Reserved.";
/** Default bottom */
private static final String DEFAULT_DESTDIR = "${project.build.directory}/site/apidocs";
/** Default doctitle */ /** Default doctitle */
private static final String DEFAULT_DOCTITLE = "${windowtitle}"; private static final String DEFAULT_DOCTITLE = "${windowtitle}";
@ -93,10 +90,13 @@ public class JavadocReport
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
/** /**
* @parameter expression="${project.build.directory}/site" * Specifies the destination directory where javadoc saves the generated HTML files.
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#d">d</a>.
*
* @parameter expression="${destDir}" alias="destDir" default-value="${project.build.directory}/javadoc/"
* @required * @required
*/ */
private String outputDirectory; private File outputDirectory;
/** /**
* @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}" * @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}"
@ -291,14 +291,6 @@ public class JavadocReport
*/ */
private String charset = "ISO-8859-1"; private String charset = "ISO-8859-1";
/**
* Specifies the destination directory where javadoc saves the generated HTML files.
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#d">d</a>.
*
* @parameter expression="${destDir}" default-value="${project.build.directory}/site/apidocs"
*/
private String destDir;
/** /**
* Enables deep copying of "doc-files" directories. * Enables deep copying of "doc-files" directories.
* See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#docfilessubdirs">docfilessubdirs</a>. * See <a href="http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#docfilessubdirs">docfilessubdirs</a>.
@ -563,7 +555,7 @@ public class JavadocReport
*/ */
protected String getOutputDirectory() protected String getOutputDirectory()
{ {
return outputDirectory; return outputDirectory.getAbsoluteFile().toString();
} }
/** /**
@ -642,7 +634,16 @@ public class JavadocReport
} }
} }
File javadocDirectory = new File( getProject().getBuild().getDirectory() + "/javadoc" ); File javadocDirectory = getReportOutputDirectory();
if ( ! javadocDirectory.equals( getOutputDirectory() ) )
{
// we're in site-embedded report mode, so Doxia has set the
// reportOutputDirectory to the basedir of the site.
// Append 'apidocs'.
javadocDirectory = new File( javadocDirectory, "apidocs" );
}
if ( fileList != null && fileList.length != 0 ) if ( fileList != null && fileList.length != 0 )
{ {
StringBuffer files = new StringBuffer(); StringBuffer files = new StringBuffer();
@ -761,12 +762,7 @@ public class JavadocReport
} }
bottom += ". All Rights Reserved."; bottom += ". All Rights Reserved.";
} }
if ( destDir.equals( DEFAULT_DESTDIR ) )
{
File outputDir = new File( getReportOutputDirectory().getAbsolutePath() + "/apidocs" );
outputDir.mkdirs();
destDir = outputDir.getAbsolutePath();
}
if ( StringUtils.isEmpty( stylesheetfile ) ) if ( StringUtils.isEmpty( stylesheetfile ) )
{ {
stylesheetfile = javadocDirectory + File.separator + DEFAULT_CSS_NAME; stylesheetfile = javadocDirectory + File.separator + DEFAULT_CSS_NAME;
@ -785,7 +781,7 @@ public class JavadocReport
addArgIfNotEmpty( arguments, "-bottom", bottom ); addArgIfNotEmpty( arguments, "-bottom", bottom );
addArgIf( arguments, breakiterator, "-breakiterator", 1.4f ); addArgIf( arguments, breakiterator, "-breakiterator", 1.4f );
addArgIfNotEmpty( arguments, "-charset", charset ); addArgIfNotEmpty( arguments, "-charset", charset );
addArgIfNotEmpty( arguments, "-d", destDir ); addArgIfNotEmpty( arguments, "-d", javadocDirectory.toString() );
addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", 1.4f ); addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", 1.4f );
addArgIfNotEmpty( arguments, "-docencoding", docencoding ); addArgIfNotEmpty( arguments, "-docencoding", docencoding );
addArgIfNotEmpty( arguments, "-doctitle", doctitle ); addArgIfNotEmpty( arguments, "-doctitle", doctitle );