mirror of https://github.com/apache/maven.git
more cleanup of site plugin
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290603 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b951c30cbf
commit
156a22fefa
|
@ -76,11 +76,6 @@ public class DoxiaMojo
|
|||
|
||||
private static final String DEFAULT_TEMPLATE = RESOURCE_DIR + "/maven-site.vm";
|
||||
|
||||
/**
|
||||
* OutputName of all reports files generated by Maven
|
||||
*/
|
||||
private static List generatedReportsFileName = new ArrayList();
|
||||
|
||||
/**
|
||||
* Patterns which should be excluded by default.
|
||||
*/
|
||||
|
@ -229,8 +224,6 @@ public class DoxiaMojo
|
|||
}
|
||||
}
|
||||
|
||||
List reports = getReports();
|
||||
|
||||
if ( attributes == null )
|
||||
{
|
||||
attributes = new HashMap();
|
||||
|
@ -258,16 +251,10 @@ public class DoxiaMojo
|
|||
Locale defaultLocale = (Locale) localesList.get( 0 );
|
||||
Locale.setDefault( defaultLocale );
|
||||
|
||||
List projectInfos = new ArrayList();
|
||||
List projectReports = new ArrayList();
|
||||
categorizeReports( reports, defaultLocale, projectInfos, projectReports );
|
||||
|
||||
for ( Iterator iterator = localesList.iterator(); iterator.hasNext(); )
|
||||
{
|
||||
Locale locale = (Locale) iterator.next();
|
||||
|
||||
String siteDescriptor = getSiteDescriptor( reports, locale, projectInfos, projectReports );
|
||||
|
||||
File outputDirectory = getOutputDirectory( locale, defaultLocale );
|
||||
|
||||
// Safety
|
||||
|
@ -276,14 +263,6 @@ public class DoxiaMojo
|
|||
outputDirectory.mkdirs();
|
||||
}
|
||||
|
||||
// Handle the GeneratedSite Directory
|
||||
File generatedSiteFile = new File( generatedSiteDirectory );
|
||||
if ( generatedSiteFile.exists() )
|
||||
{
|
||||
siteRenderer.render( generatedSiteFile, outputDirectory, siteDescriptor, template, attributes,
|
||||
locale );
|
||||
}
|
||||
|
||||
// Generate static site
|
||||
File siteDirectoryFile = new File( siteDirectory );
|
||||
if ( !locale.getLanguage().equals( defaultLocale.getLanguage() ) )
|
||||
|
@ -297,6 +276,10 @@ public class DoxiaMojo
|
|||
{
|
||||
tryToFindDuplicates( siteDirectoryFile, duplicate );
|
||||
}
|
||||
|
||||
// Handle the GeneratedSite Directory
|
||||
File generatedSiteFile = new File( generatedSiteDirectory );
|
||||
|
||||
if ( generatedSiteFile.exists() )
|
||||
{
|
||||
tryToFindDuplicates( generatedSiteFile, duplicate );
|
||||
|
@ -309,10 +292,37 @@ public class DoxiaMojo
|
|||
throw new MavenReportException( msg );
|
||||
}
|
||||
|
||||
List reports = getReports();
|
||||
|
||||
Map categories = categorizeReports( reports );
|
||||
|
||||
List projectInfos = (List) categories.get( MavenReport.CATEGORY_PROJECT_INFORMATION );
|
||||
List projectReports = (List) categories.get( MavenReport.CATEGORY_PROJECT_REPORTS );
|
||||
|
||||
if ( projectInfos == null )
|
||||
{
|
||||
projectInfos = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
if ( projectReports == null )
|
||||
{
|
||||
projectReports = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
String siteDescriptor = getSiteDescriptor( reports, locale, projectInfos, projectReports );
|
||||
|
||||
if ( generatedSiteFile.exists() )
|
||||
{
|
||||
siteRenderer.render( generatedSiteFile, outputDirectory, siteDescriptor, template, attributes,
|
||||
locale );
|
||||
}
|
||||
|
||||
//Generate reports
|
||||
List generatedReportsFileName = Collections.EMPTY_LIST;
|
||||
if ( reports != null )
|
||||
{
|
||||
generateReportsPages( reports, locale, outputDirectory, defaultLocale, siteDescriptor );
|
||||
generatedReportsFileName = generateReportsPages( reports, locale, outputDirectory, defaultLocale,
|
||||
siteDescriptor );
|
||||
}
|
||||
|
||||
//Generate overview pages
|
||||
|
@ -418,26 +428,23 @@ public class DoxiaMojo
|
|||
}
|
||||
}
|
||||
|
||||
private void categorizeReports( List reports, Locale defaultLocale, List projectInfos, List projectReports )
|
||||
throws MojoExecutionException
|
||||
private Map categorizeReports( List reports )
|
||||
{
|
||||
Map categories = new HashMap();
|
||||
|
||||
for ( Iterator i = reports.iterator(); i.hasNext(); )
|
||||
{
|
||||
MavenReport report = (MavenReport) i.next();
|
||||
if ( MavenReport.CATEGORY_PROJECT_INFORMATION.equals( report.getCategoryName() ) )
|
||||
|
||||
List category = (List) categories.get( report.getCategoryName() );
|
||||
if ( category == null )
|
||||
{
|
||||
projectInfos.add( report );
|
||||
}
|
||||
else if ( MavenReport.CATEGORY_PROJECT_REPORTS.equals( report.getCategoryName() ) )
|
||||
{
|
||||
projectReports.add( report );
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new MojoExecutionException( "'" + report.getCategoryName() + "' category define for " +
|
||||
report.getName( defaultLocale ) + " mojo isn't valid." );
|
||||
category = new ArrayList();
|
||||
categories.put( report.getCategoryName(), category );
|
||||
}
|
||||
category.add( report );
|
||||
}
|
||||
return categories;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -741,10 +748,12 @@ public class DoxiaMojo
|
|||
* @param locale
|
||||
* @param localeOutputDirectory
|
||||
*/
|
||||
private void generateReportsPages( List reports, Locale locale, File localeOutputDirectory, Locale defaultLocale,
|
||||
private List generateReportsPages( List reports, Locale locale, File localeOutputDirectory, Locale defaultLocale,
|
||||
String siteDescriptor )
|
||||
throws RendererException, IOException, MavenReportException
|
||||
{
|
||||
List generatedReportsFileName = new ArrayList();
|
||||
|
||||
for ( Iterator j = reports.iterator(); j.hasNext(); )
|
||||
{
|
||||
MavenReport report = (MavenReport) j.next();
|
||||
|
@ -785,6 +794,7 @@ public class DoxiaMojo
|
|||
sink, locale );
|
||||
}
|
||||
}
|
||||
return generatedReportsFileName;
|
||||
}
|
||||
|
||||
private void generateProjectInfoPage( String siteDescriptor, Locale locale, List projectInfos,
|
||||
|
|
Loading…
Reference in New Issue