mirror of https://github.com/apache/maven.git
clean up MavenReportException uses
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@314937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0ad22e0a67
commit
ec7316abed
|
@ -38,15 +38,16 @@ import org.codehaus.plexus.util.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||||
|
@ -240,7 +241,8 @@ public class CheckstyleReport
|
||||||
{
|
{
|
||||||
if ( !canGenerateReport() )
|
if ( !canGenerateReport() )
|
||||||
{
|
{
|
||||||
throw new MavenReportException( "No source directory to process for style" );
|
// TODO: failure if not a report
|
||||||
|
throw new MavenReportException( "No source directory to process for checkstyle" );
|
||||||
}
|
}
|
||||||
|
|
||||||
Map files = executeCheckstyle();
|
Map files = executeCheckstyle();
|
||||||
|
@ -253,22 +255,30 @@ public class CheckstyleReport
|
||||||
private Map executeCheckstyle()
|
private Map executeCheckstyle()
|
||||||
throws MavenReportException
|
throws MavenReportException
|
||||||
{
|
{
|
||||||
File[] files = getFilesToProcess( includes, excludes );
|
File[] files = new File[0];
|
||||||
|
try
|
||||||
|
{
|
||||||
|
files = getFilesToProcess( includes, excludes );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new MavenReportException( "Error getting files to process", e );
|
||||||
|
}
|
||||||
|
|
||||||
String configFile = getConfigFile();
|
String configFile = getConfigFile();
|
||||||
|
|
||||||
Properties overridingProperties = getOverridingProperties();
|
Properties overridingProperties = getOverridingProperties();
|
||||||
|
|
||||||
ModuleFactory moduleFactory = getModuleFactory();
|
|
||||||
|
|
||||||
FilterSet filterSet = getSuppressions();
|
|
||||||
|
|
||||||
Checker checker;
|
Checker checker;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Configuration config = ConfigurationLoader.loadConfiguration( configFile, new PropertiesExpander(
|
ModuleFactory moduleFactory = getModuleFactory();
|
||||||
overridingProperties ) );
|
|
||||||
|
FilterSet filterSet = getSuppressions();
|
||||||
|
|
||||||
|
Configuration config =
|
||||||
|
ConfigurationLoader.loadConfiguration( configFile, new PropertiesExpander( overridingProperties ) );
|
||||||
|
|
||||||
checker = new Checker();
|
checker = new Checker();
|
||||||
|
|
||||||
|
@ -313,6 +323,8 @@ public class CheckstyleReport
|
||||||
|
|
||||||
if ( failsOnError && nbErrors > 0 )
|
if ( failsOnError && nbErrors > 0 )
|
||||||
{
|
{
|
||||||
|
// TODO: should be a failure, not an error. Report is not meant to throw an exception here (so site would
|
||||||
|
// work regardless of config), but should record this information
|
||||||
throw new MavenReportException( "There are " + nbErrors + " formatting errors." );
|
throw new MavenReportException( "There are " + nbErrors + " formatting errors." );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,6 +360,7 @@ public class CheckstyleReport
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// TODO: failure if not a report
|
||||||
throw new MavenReportException(
|
throw new MavenReportException(
|
||||||
"Invalid output file format: (" + outputFileFormat + "). Must be 'plain' or 'xml'." );
|
"Invalid output file format: (" + outputFileFormat + "). Must be 'plain' or 'xml'." );
|
||||||
}
|
}
|
||||||
|
@ -358,8 +371,6 @@ public class CheckstyleReport
|
||||||
|
|
||||||
private OutputStream getOutputStream( File file )
|
private OutputStream getOutputStream( File file )
|
||||||
throws MavenReportException
|
throws MavenReportException
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
File parentFile = file.getAbsoluteFile().getParentFile();
|
File parentFile = file.getAbsoluteFile().getParentFile();
|
||||||
|
|
||||||
|
@ -368,16 +379,20 @@ public class CheckstyleReport
|
||||||
parentFile.mkdirs();
|
parentFile.mkdirs();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new FileOutputStream( file );
|
FileOutputStream fileOutputStream = null;
|
||||||
}
|
try
|
||||||
catch ( IOException ioe )
|
|
||||||
{
|
{
|
||||||
throw new MavenReportException( "Can't open file for output: " + file.getAbsolutePath(), ioe );
|
fileOutputStream = new FileOutputStream( file );
|
||||||
}
|
}
|
||||||
|
catch ( FileNotFoundException e )
|
||||||
|
{
|
||||||
|
throw new MavenReportException( "Unable to create output stream: " + file, e );
|
||||||
|
}
|
||||||
|
return fileOutputStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
private File[] getFilesToProcess( String includes, String excludes )
|
private File[] getFilesToProcess( String includes, String excludes )
|
||||||
throws MavenReportException
|
throws MavenReportException, IOException
|
||||||
{
|
{
|
||||||
StringBuffer excludesStr = new StringBuffer();
|
StringBuffer excludesStr = new StringBuffer();
|
||||||
|
|
||||||
|
@ -397,16 +412,7 @@ public class CheckstyleReport
|
||||||
excludesStr.append( defaultExcludes[i] );
|
excludesStr.append( defaultExcludes[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
List files;
|
List files = FileUtils.getFiles( sourceDirectory, includes, excludesStr.toString() );
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
files = FileUtils.getFiles( sourceDirectory, includes, excludesStr.toString() );
|
|
||||||
}
|
|
||||||
catch ( IOException ioe )
|
|
||||||
{
|
|
||||||
throw new MavenReportException( "Failed to get source files", ioe );
|
|
||||||
}
|
|
||||||
|
|
||||||
return (File[]) files.toArray( EMPTY_FILE_ARRAY );
|
return (File[]) files.toArray( EMPTY_FILE_ARRAY );
|
||||||
}
|
}
|
||||||
|
@ -419,9 +425,16 @@ public class CheckstyleReport
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ( propertiesFile != null )
|
if ( propertiesFile != null )
|
||||||
|
{
|
||||||
|
if ( propertiesFile.exists() )
|
||||||
{
|
{
|
||||||
p.load( new FileInputStream( propertiesFile ) );
|
p.load( new FileInputStream( propertiesFile ) );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getLog().warn( "File '" + propertiesFile + "' not found - skipping" );
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ( propertiesURL != null )
|
else if ( propertiesURL != null )
|
||||||
{
|
{
|
||||||
p.load( propertiesURL.openStream() );
|
p.load( propertiesURL.openStream() );
|
||||||
|
@ -465,6 +478,7 @@ public class CheckstyleReport
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// TODO: failure if not a report
|
||||||
throw new MavenReportException( "Invalid configuration file format: " + format );
|
throw new MavenReportException( "Invalid configuration file format: " + format );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,22 +486,15 @@ public class CheckstyleReport
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleFactory getModuleFactory()
|
private ModuleFactory getModuleFactory()
|
||||||
throws MavenReportException
|
throws CheckstyleException
|
||||||
{
|
{
|
||||||
if ( StringUtils.isEmpty( packageNamesFile ) )
|
if ( StringUtils.isEmpty( packageNamesFile ) )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return PackageNamesLoader.loadModuleFactory( packageNamesFile );
|
return PackageNamesLoader.loadModuleFactory( packageNamesFile );
|
||||||
}
|
}
|
||||||
catch ( CheckstyleException ce )
|
|
||||||
{
|
|
||||||
throw new MavenReportException( "failed to load package names XML: " + packageNamesFile, ce );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private FilterSet getSuppressions()
|
private FilterSet getSuppressions()
|
||||||
throws MavenReportException
|
throws MavenReportException
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.plugin.javadoc;
|
||||||
import org.apache.commons.lang.ClassUtils;
|
import org.apache.commons.lang.ClassUtils;
|
||||||
import org.apache.commons.lang.SystemUtils;
|
import org.apache.commons.lang.SystemUtils;
|
||||||
import org.apache.commons.lang.math.NumberUtils;
|
import org.apache.commons.lang.math.NumberUtils;
|
||||||
|
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.AbstractMavenReport;
|
import org.apache.maven.reporting.AbstractMavenReport;
|
||||||
|
@ -28,6 +29,7 @@ import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
import org.codehaus.plexus.util.IOUtil;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
import org.codehaus.plexus.util.cli.CommandLineException;
|
||||||
import org.codehaus.plexus.util.cli.CommandLineUtils;
|
import org.codehaus.plexus.util.cli.CommandLineUtils;
|
||||||
import org.codehaus.plexus.util.cli.Commandline;
|
import org.codehaus.plexus.util.cli.Commandline;
|
||||||
import org.codehaus.plexus.util.cli.DefaultConsumer;
|
import org.codehaus.plexus.util.cli.DefaultConsumer;
|
||||||
|
@ -578,8 +580,6 @@ public class JavadocReport
|
||||||
*/
|
*/
|
||||||
protected void executeReport( Locale locale )
|
protected void executeReport( Locale locale )
|
||||||
throws MavenReportException
|
throws MavenReportException
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
int actualYear = Calendar.getInstance().get( Calendar.YEAR );
|
int actualYear = Calendar.getInstance().get( Calendar.YEAR );
|
||||||
String year = String.valueOf( actualYear );
|
String year = String.valueOf( actualYear );
|
||||||
|
@ -602,6 +602,8 @@ public class JavadocReport
|
||||||
|
|
||||||
StringBuffer options = new StringBuffer();
|
StringBuffer options = new StringBuffer();
|
||||||
StringBuffer classpath = new StringBuffer();
|
StringBuffer classpath = new StringBuffer();
|
||||||
|
try
|
||||||
|
{
|
||||||
for ( Iterator i = getProject().getCompileClasspathElements().iterator(); i.hasNext(); )
|
for ( Iterator i = getProject().getCompileClasspathElements().iterator(); i.hasNext(); )
|
||||||
{
|
{
|
||||||
classpath.append( (String) i.next() );
|
classpath.append( (String) i.next() );
|
||||||
|
@ -611,6 +613,11 @@ public class JavadocReport
|
||||||
classpath.append( PATH_SEPARATOR );
|
classpath.append( PATH_SEPARATOR );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch ( DependencyResolutionRequiredException e )
|
||||||
|
{
|
||||||
|
throw new MavenReportException( "Error in plugin descriptor - compile dependencies were not resolved", e );
|
||||||
|
}
|
||||||
|
|
||||||
if ( classpath.length() > 0 )
|
if ( classpath.length() > 0 )
|
||||||
{
|
{
|
||||||
|
@ -659,10 +666,24 @@ public class JavadocReport
|
||||||
|
|
||||||
File file = new File( javadocDirectory, "files" );
|
File file = new File( javadocDirectory, "files" );
|
||||||
file.deleteOnExit();
|
file.deleteOnExit();
|
||||||
|
try
|
||||||
|
{
|
||||||
FileUtils.fileWrite( file.getAbsolutePath(), files.toString() );
|
FileUtils.fileWrite( file.getAbsolutePath(), files.toString() );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new MavenReportException( "Unable to write temporary file for command execution", e );
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
// Copy default style sheet
|
// Copy default style sheet
|
||||||
copyDefaultStylesheet( javadocDirectory );
|
copyDefaultStylesheet( javadocDirectory );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new MavenReportException( "Unable to copy default stylesheet", e );
|
||||||
|
}
|
||||||
|
|
||||||
Commandline cmd = new Commandline();
|
Commandline cmd = new Commandline();
|
||||||
|
|
||||||
|
@ -698,8 +719,7 @@ public class JavadocReport
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getLog().error(
|
getLog().error( "The maxmemory '" + maxmemory + "' is not a valid number. Ignore this option." );
|
||||||
"The maxmemory '" + maxmemory + "' is not a valid number. Ignore this option." );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -720,8 +740,7 @@ public class JavadocReport
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
getLog().error(
|
getLog().error( "The minmemory '" + minmemory + "' is not a valid number. Ignore this option." );
|
||||||
"The minmemory '" + minmemory + "' is not a valid number. Ignore this option." );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -774,8 +793,7 @@ public class JavadocReport
|
||||||
addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", 1.4f );
|
addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", 1.4f );
|
||||||
addArgIfNotEmpty( arguments, "-docencoding", quotedArgument( docencoding ) );
|
addArgIfNotEmpty( arguments, "-docencoding", quotedArgument( docencoding ) );
|
||||||
addArgIfNotEmpty( arguments, "-doctitle", quotedArgument( doctitle ) );
|
addArgIfNotEmpty( arguments, "-doctitle", quotedArgument( doctitle ) );
|
||||||
addArgIfNotEmpty( arguments, "-excludedocfilessubdir", quotedPathArgument( excludedocfilessubdir ),
|
addArgIfNotEmpty( arguments, "-excludedocfilessubdir", quotedPathArgument( excludedocfilessubdir ), 1.4f );
|
||||||
1.4f );
|
|
||||||
addArgIfNotEmpty( arguments, "-footer", quotedArgument( footer ) );
|
addArgIfNotEmpty( arguments, "-footer", quotedArgument( footer ) );
|
||||||
addArgIfNotEmpty( arguments, "-group", quotedArgument( group ), true );
|
addArgIfNotEmpty( arguments, "-group", quotedArgument( group ), true );
|
||||||
addArgIfNotEmpty( arguments, "-header", quotedArgument( header ) );
|
addArgIfNotEmpty( arguments, "-header", quotedArgument( header ) );
|
||||||
|
@ -811,7 +829,14 @@ public class JavadocReport
|
||||||
options.append( " " );
|
options.append( " " );
|
||||||
options.append( (String) it.next() );
|
options.append( (String) it.next() );
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
FileUtils.fileWrite( optionsFile.getAbsolutePath(), options.toString() );
|
FileUtils.fileWrite( optionsFile.getAbsolutePath(), options.toString() );
|
||||||
|
}
|
||||||
|
catch ( IOException e )
|
||||||
|
{
|
||||||
|
throw new MavenReportException( "Unable to write temporary file for command execution", e );
|
||||||
|
}
|
||||||
cmd.createArgument().setValue( "@options" );
|
cmd.createArgument().setValue( "@options" );
|
||||||
optionsFile.deleteOnExit();
|
optionsFile.deleteOnExit();
|
||||||
}
|
}
|
||||||
|
@ -820,17 +845,19 @@ public class JavadocReport
|
||||||
|
|
||||||
getLog().info( Commandline.toString( cmd.getCommandline() ) );
|
getLog().info( Commandline.toString( cmd.getCommandline() ) );
|
||||||
|
|
||||||
int exitCode = CommandLineUtils.executeCommandLine( cmd, new DefaultConsumer(), new DefaultConsumer() );
|
CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int exitCode = CommandLineUtils.executeCommandLine( cmd, new DefaultConsumer(), err );
|
||||||
|
|
||||||
if ( exitCode != 0 )
|
if ( exitCode != 0 )
|
||||||
{
|
{
|
||||||
throw new MavenReportException( "Exit code: " + exitCode );
|
throw new MavenReportException( "Exit code: " + exitCode + " - " + err.getOutput() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( Exception e )
|
catch ( CommandLineException e )
|
||||||
{
|
{
|
||||||
getLog().debug( e );
|
throw new MavenReportException( "Unable to execute javadoc command", e );
|
||||||
throw new MavenReportException( "An error has occurred in javadoc report generation.", e );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1034,10 +1061,8 @@ public class JavadocReport
|
||||||
* @param resource the resource
|
* @param resource the resource
|
||||||
* @return InputStream An input stream for reading the resource, or <tt>null</tt>
|
* @return InputStream An input stream for reading the resource, or <tt>null</tt>
|
||||||
* if the resource could not be found
|
* if the resource could not be found
|
||||||
* @throws Exception if any
|
|
||||||
*/
|
*/
|
||||||
private static InputStream getStream( String resource )
|
private static InputStream getStream( String resource )
|
||||||
throws Exception
|
|
||||||
{
|
{
|
||||||
return JavadocReport.class.getClassLoader().getResourceAsStream( resource );
|
return JavadocReport.class.getClassLoader().getResourceAsStream( resource );
|
||||||
}
|
}
|
||||||
|
@ -1047,14 +1072,14 @@ public class JavadocReport
|
||||||
* loader to the output directory.
|
* loader to the output directory.
|
||||||
*
|
*
|
||||||
* @param outputDirectory the output directory
|
* @param outputDirectory the output directory
|
||||||
* @throws Exception if any
|
* @throws IOException if any
|
||||||
* @see #DEFAULT_CSS_NAME
|
* @see #DEFAULT_CSS_NAME
|
||||||
*/
|
*/
|
||||||
private void copyDefaultStylesheet( File outputDirectory )
|
private void copyDefaultStylesheet( File outputDirectory )
|
||||||
throws Exception
|
throws IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
if ( ( outputDirectory == null ) || ( !outputDirectory.exists() ) )
|
if ( outputDirectory == null || !outputDirectory.exists() )
|
||||||
{
|
{
|
||||||
throw new IOException( "The outputDirectory " + outputDirectory + " doesn't exists." );
|
throw new IOException( "The outputDirectory " + outputDirectory + " doesn't exists." );
|
||||||
}
|
}
|
||||||
|
@ -1084,6 +1109,6 @@ public class JavadocReport
|
||||||
|
|
||||||
public boolean isExternalReport()
|
public boolean isExternalReport()
|
||||||
{
|
{
|
||||||
return true;
|
return true && super.isExternalReport();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.maven.model.Notifier;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.AbstractMavenReport;
|
import org.apache.maven.reporting.AbstractMavenReport;
|
||||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||||
import org.apache.maven.reporting.MavenReportException;
|
|
||||||
import org.codehaus.doxia.sink.Sink;
|
import org.codehaus.doxia.sink.Sink;
|
||||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
@ -107,7 +106,6 @@ public class CimReport
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeReport( Locale locale )
|
public void executeReport( Locale locale )
|
||||||
throws MavenReportException
|
|
||||||
{
|
{
|
||||||
CimRenderer r = new CimRenderer( getSink(), getProject().getModel(), locale );
|
CimRenderer r = new CimRenderer( getSink(), getProject().getModel(), locale );
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.maven.project.MavenProjectBuilder;
|
||||||
import org.apache.maven.project.ProjectBuildingException;
|
import org.apache.maven.project.ProjectBuildingException;
|
||||||
import org.apache.maven.reporting.AbstractMavenReport;
|
import org.apache.maven.reporting.AbstractMavenReport;
|
||||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||||
import org.apache.maven.reporting.MavenReportException;
|
|
||||||
import org.codehaus.doxia.sink.Sink;
|
import org.codehaus.doxia.sink.Sink;
|
||||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
|
|
||||||
|
@ -151,7 +150,6 @@ public class DependenciesReport
|
||||||
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
||||||
*/
|
*/
|
||||||
public void executeReport( Locale locale )
|
public void executeReport( Locale locale )
|
||||||
throws MavenReportException
|
|
||||||
{
|
{
|
||||||
DependenciesRenderer r = new DependenciesRenderer( getSink(), getProject(), locale, mavenProjectBuilder,
|
DependenciesRenderer r = new DependenciesRenderer( getSink(), getProject(), locale, mavenProjectBuilder,
|
||||||
artifactFactory, localRepository );
|
artifactFactory, localRepository );
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.AbstractMavenReport;
|
import org.apache.maven.reporting.AbstractMavenReport;
|
||||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||||
import org.apache.maven.reporting.MavenReportException;
|
|
||||||
import org.codehaus.doxia.sink.Sink;
|
import org.codehaus.doxia.sink.Sink;
|
||||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
@ -117,7 +116,6 @@ public class IssueTrackingReport
|
||||||
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
||||||
*/
|
*/
|
||||||
public void executeReport( Locale locale )
|
public void executeReport( Locale locale )
|
||||||
throws MavenReportException
|
|
||||||
{
|
{
|
||||||
IssueTrackingRenderer r = new IssueTrackingRenderer( getSink(), getProject().getModel(), locale );
|
IssueTrackingRenderer r = new IssueTrackingRenderer( getSink(), getProject().getModel(), locale );
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.apache.maven.model.License;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.AbstractMavenReport;
|
import org.apache.maven.reporting.AbstractMavenReport;
|
||||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||||
import org.apache.maven.reporting.MavenReportException;
|
|
||||||
import org.codehaus.doxia.sink.Sink;
|
import org.codehaus.doxia.sink.Sink;
|
||||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
import org.codehaus.plexus.util.IOUtil;
|
||||||
|
@ -128,7 +127,6 @@ public class LicenseReport
|
||||||
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
||||||
*/
|
*/
|
||||||
public void executeReport( Locale locale )
|
public void executeReport( Locale locale )
|
||||||
throws MavenReportException
|
|
||||||
{
|
{
|
||||||
LicenseRenderer r = new LicenseRenderer( getSink(), getProject(), locale );
|
LicenseRenderer r = new LicenseRenderer( getSink(), getProject(), locale );
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.AbstractMavenReport;
|
import org.apache.maven.reporting.AbstractMavenReport;
|
||||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||||
import org.apache.maven.reporting.MavenReportException;
|
|
||||||
import org.codehaus.doxia.sink.Sink;
|
import org.codehaus.doxia.sink.Sink;
|
||||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
@ -119,7 +118,6 @@ public class MailingListsReport
|
||||||
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
||||||
*/
|
*/
|
||||||
public void executeReport( Locale locale )
|
public void executeReport( Locale locale )
|
||||||
throws MavenReportException
|
|
||||||
{
|
{
|
||||||
MailingListsRenderer r = new MailingListsRenderer( getSink(), getProject().getModel(), locale );
|
MailingListsRenderer r = new MailingListsRenderer( getSink(), getProject().getModel(), locale );
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.apache.maven.model.Scm;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.AbstractMavenReport;
|
import org.apache.maven.reporting.AbstractMavenReport;
|
||||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||||
import org.apache.maven.reporting.MavenReportException;
|
|
||||||
import org.apache.maven.scm.manager.NoSuchScmProviderException;
|
import org.apache.maven.scm.manager.NoSuchScmProviderException;
|
||||||
import org.apache.maven.scm.manager.ScmManager;
|
import org.apache.maven.scm.manager.ScmManager;
|
||||||
import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
|
import org.apache.maven.scm.provider.clearcase.repository.ClearCaseScmProviderRepository;
|
||||||
|
@ -135,7 +134,6 @@ public class ScmReport
|
||||||
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
||||||
*/
|
*/
|
||||||
public void executeReport( Locale locale )
|
public void executeReport( Locale locale )
|
||||||
throws MavenReportException
|
|
||||||
{
|
{
|
||||||
ScmRenderer r = new ScmRenderer( scmManager, getSink(), getProject().getModel(), locale );
|
ScmRenderer r = new ScmRenderer( scmManager, getSink(), getProject().getModel(), locale );
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.AbstractMavenReport;
|
import org.apache.maven.reporting.AbstractMavenReport;
|
||||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||||
import org.apache.maven.reporting.MavenReportException;
|
|
||||||
import org.codehaus.doxia.sink.Sink;
|
import org.codehaus.doxia.sink.Sink;
|
||||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
@ -121,7 +120,6 @@ public class TeamListReport
|
||||||
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
||||||
*/
|
*/
|
||||||
public void executeReport( Locale locale )
|
public void executeReport( Locale locale )
|
||||||
throws MavenReportException
|
|
||||||
{
|
{
|
||||||
TeamListRenderer r = new TeamListRenderer( getSink(), getProject().getModel(), locale );
|
TeamListRenderer r = new TeamListRenderer( getSink(), getProject().getModel(), locale );
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.maven.plugins.site;
|
||||||
|
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.apache.maven.plugin.MojoFailureException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.reporting.MavenReport;
|
import org.apache.maven.reporting.MavenReport;
|
||||||
import org.apache.maven.reporting.MavenReportException;
|
import org.apache.maven.reporting.MavenReportException;
|
||||||
|
@ -44,6 +45,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
@ -51,7 +53,6 @@ import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.Comparator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates the project site.
|
* Generates the project site.
|
||||||
|
@ -178,7 +179,7 @@ public class SiteMojo
|
||||||
* @see org.apache.maven.plugin.Mojo#execute()
|
* @see org.apache.maven.plugin.Mojo#execute()
|
||||||
*/
|
*/
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException, MojoFailureException
|
||||||
{
|
{
|
||||||
if ( templateDirectory == null )
|
if ( templateDirectory == null )
|
||||||
{
|
{
|
||||||
|
@ -289,11 +290,7 @@ public class SiteMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exception if a file is duplicate
|
// Exception if a file is duplicate
|
||||||
String msg = createDuplicateExceptionMsg( duplicate, locale );
|
checkDuplicates( duplicate, locale );
|
||||||
if ( msg != null )
|
|
||||||
{
|
|
||||||
throw new MavenReportException( msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
String siteDescriptor = getSiteDescriptor( reports, locale, projectInfos, projectReports );
|
String siteDescriptor = getSiteDescriptor( reports, locale, projectInfos, projectReports );
|
||||||
|
|
||||||
|
@ -1132,13 +1129,13 @@ public class SiteMojo
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an <code>Exception</code> message if a file is duplicate.
|
* Throw an exception if a file is duplicate.
|
||||||
*
|
*
|
||||||
* @param duplicate a map of duplicate files
|
* @param duplicate a map of duplicate files
|
||||||
* @param locale the current locale
|
* @param locale the current locale
|
||||||
* @return the Message to throw
|
|
||||||
*/
|
*/
|
||||||
private String createDuplicateExceptionMsg( Map duplicate, Locale locale )
|
private void checkDuplicates( Map duplicate, Locale locale )
|
||||||
|
throws MojoFailureException
|
||||||
{
|
{
|
||||||
if ( duplicate.size() > 0 )
|
if ( duplicate.size() > 0 )
|
||||||
{
|
{
|
||||||
|
@ -1182,11 +1179,9 @@ public class SiteMojo
|
||||||
|
|
||||||
if ( sb != null )
|
if ( sb != null )
|
||||||
{
|
{
|
||||||
return sb.toString();
|
throw new MojoFailureException( sb.toString() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue