package org.apache.maven.plugin.javadoc;
/*
* 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.File;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import org.apache.maven.doxia.sink.render.RenderingContext;
import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.codehaus.doxia.sink.Sink;
import org.codehaus.plexus.util.StringUtils;
/**
* Generates documentation for the Java code
in an NON aggregator project using the standard
* Javadoc Tool.
*
* @author Emmanuel Venisse
* @author Vincent Siveton
* @version $Id: JavadocReport.java 824994 2009-10-14 01:08:26Z vsiveton $
* @since 2.0
* @goal javadoc
* @execute phase="generate-sources"
* @see Javadoc Tool
* @see Javadoc Options
*/
public class JavadocReport
extends AbstractJavadocMojo
implements MavenReport
{
// ----------------------------------------------------------------------
// Report Mojo Parameters
// ----------------------------------------------------------------------
/**
* Specifies the destination directory where javadoc saves the generated HTML files.
*
* @parameter expression="${reportOutputDirectory}" default-value="${project.reporting.outputDirectory}/apidocs"
* @required
*/
private File reportOutputDirectory;
/**
* The name of the destination directory.
*
*
* @since 2.1
* @parameter expression="${destDir}" default-value="apidocs"
*/
private String destDir;
/**
* The name of the Javadoc report to be displayed in the Maven Generated Reports page
* (i.e. project-reports.html
).
*
* @since 2.1
* @parameter expression="${name}"
*/
private String name;
/**
* The description of the Javadoc report to be displayed in the Maven Generated Reports page
* (i.e. project-reports.html
).
*
* @since 2.1
* @parameter expression="${description}"
*/
private String description;
// ----------------------------------------------------------------------
// Report public methods
// ----------------------------------------------------------------------
/** {@inheritDoc} */
public String getName( Locale locale )
{
if ( StringUtils.isEmpty( name ) )
{
return getBundle( locale ).getString( "report.javadoc.name" );
}
return name;
}
/** {@inheritDoc} */
public String getDescription( Locale locale )
{
if ( StringUtils.isEmpty( description ) )
{
return getBundle( locale ).getString( "report.javadoc.description" );
}
return description;
}
/** {@inheritDoc} */
public void generate( Sink sink, Locale locale )
throws MavenReportException
{
outputDirectory = getReportOutputDirectory();
executeReport( locale );
}
/** {@inheritDoc} */
public String getOutputName()
{
return destDir + "/index";
}
/** {@inheritDoc} */
public boolean isExternalReport()
{
return true;
}
/**
* {@inheritDoc}
*
*
* The logic is the following:
*
isAggregator | *hasSourceFiles | *isRootProject | *Generate Report | *
---|---|---|---|
True | *True | *True | *True | *
True | *True | *False | *False | *
True | *False | *True | *False | *
True | *False | *False | *False | *
False | *True | *True | *True | *
False | *True | *False | *True | *
False | *False | *True | *False | *
False | *False | *False | *False | *