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'." );
|
||||||
}
|
}
|
||||||
|
@ -359,25 +372,27 @@ public class CheckstyleReport
|
||||||
private OutputStream getOutputStream( File file )
|
private OutputStream getOutputStream( File file )
|
||||||
throws MavenReportException
|
throws MavenReportException
|
||||||
{
|
{
|
||||||
|
File parentFile = file.getAbsoluteFile().getParentFile();
|
||||||
|
|
||||||
|
if ( !parentFile.exists() )
|
||||||
|
{
|
||||||
|
parentFile.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileOutputStream fileOutputStream = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File parentFile = file.getAbsoluteFile().getParentFile();
|
fileOutputStream = new FileOutputStream( file );
|
||||||
|
|
||||||
if ( !parentFile.exists() )
|
|
||||||
{
|
|
||||||
parentFile.mkdirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new FileOutputStream( file );
|
|
||||||
}
|
}
|
||||||
catch ( IOException ioe )
|
catch ( FileNotFoundException e )
|
||||||
{
|
{
|
||||||
throw new MavenReportException( "Can't open file for output: " + file.getAbsolutePath(), ioe );
|
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 );
|
||||||
}
|
}
|
||||||
|
@ -420,7 +426,14 @@ public class CheckstyleReport
|
||||||
{
|
{
|
||||||
if ( propertiesFile != null )
|
if ( propertiesFile != null )
|
||||||
{
|
{
|
||||||
p.load( new FileInputStream( propertiesFile ) );
|
if ( propertiesFile.exists() )
|
||||||
|
{
|
||||||
|
p.load( new FileInputStream( propertiesFile ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getLog().warn( "File '" + propertiesFile + "' not found - skipping" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( propertiesURL != null )
|
else if ( propertiesURL != null )
|
||||||
{
|
{
|
||||||
|
@ -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,21 +486,14 @@ 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()
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -579,29 +581,29 @@ 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 );
|
||||||
{
|
String year = String.valueOf( actualYear );
|
||||||
int actualYear = Calendar.getInstance().get( Calendar.YEAR );
|
|
||||||
String year = String.valueOf( actualYear );
|
|
||||||
|
|
||||||
Model model = getProject().getModel();
|
Model model = getProject().getModel();
|
||||||
if ( model.getInceptionYear() != null )
|
if ( model.getInceptionYear() != null )
|
||||||
|
{
|
||||||
|
if ( StringUtils.isNumeric( model.getInceptionYear() ) )
|
||||||
{
|
{
|
||||||
if ( StringUtils.isNumeric( model.getInceptionYear() ) )
|
if ( Integer.valueOf( model.getInceptionYear() ).intValue() != actualYear )
|
||||||
{
|
{
|
||||||
if ( Integer.valueOf( model.getInceptionYear() ).intValue() != actualYear )
|
year = model.getInceptionYear() + "-" + String.valueOf( actualYear );
|
||||||
{
|
|
||||||
year = model.getInceptionYear() + "-" + String.valueOf( actualYear );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getLog().warn( "The inception year is not a valid year." );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
getLog().warn( "The inception year is not a valid year." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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,226 +613,251 @@ 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 )
|
||||||
|
{
|
||||||
|
options.append( "-classpath " );
|
||||||
|
options.append( quotedPathArgument( classpath.toString() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuffer sourcePath = new StringBuffer();
|
||||||
|
StringBuffer files = new StringBuffer();
|
||||||
|
for ( Iterator i = getProject().getCompileSourceRoots().iterator(); i.hasNext(); )
|
||||||
|
{
|
||||||
|
String sourceDirectory = (String) i.next();
|
||||||
|
String[] fileList = FileUtils.getFilesFromExtension( sourceDirectory, new String[]{"java"} );
|
||||||
|
if ( fileList != null && fileList.length != 0 )
|
||||||
{
|
{
|
||||||
options.append( "-classpath " );
|
for ( int j = 0; j < fileList.length; j++ )
|
||||||
options.append( quotedPathArgument( classpath.toString() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuffer sourcePath = new StringBuffer();
|
|
||||||
StringBuffer files = new StringBuffer();
|
|
||||||
for ( Iterator i = getProject().getCompileSourceRoots().iterator(); i.hasNext(); )
|
|
||||||
{
|
|
||||||
String sourceDirectory = (String) i.next();
|
|
||||||
String[] fileList = FileUtils.getFilesFromExtension( sourceDirectory, new String[]{"java"} );
|
|
||||||
if ( fileList != null && fileList.length != 0 )
|
|
||||||
{
|
{
|
||||||
for ( int j = 0; j < fileList.length; j++ )
|
files.append( quotedPathArgument( fileList[j] ) );
|
||||||
{
|
files.append( "\n" );
|
||||||
files.append( quotedPathArgument( fileList[j] ) );
|
|
||||||
files.append( "\n" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sourcePath.append( sourceDirectory );
|
|
||||||
|
|
||||||
if ( i.hasNext() )
|
|
||||||
{
|
|
||||||
sourcePath.append( PATH_SEPARATOR );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( files.length() == 0 )
|
sourcePath.append( sourceDirectory );
|
||||||
|
|
||||||
|
if ( i.hasNext() )
|
||||||
{
|
{
|
||||||
return;
|
sourcePath.append( PATH_SEPARATOR );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File javadocDirectory = getReportOutputDirectory();
|
if ( files.length() == 0 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( !javadocDirectory.equals( getOutputDirectory() ) )
|
File javadocDirectory = getReportOutputDirectory();
|
||||||
{
|
|
||||||
// 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" );
|
|
||||||
}
|
|
||||||
javadocDirectory.mkdirs();
|
|
||||||
|
|
||||||
File file = new File( javadocDirectory, "files" );
|
if ( !javadocDirectory.equals( getOutputDirectory() ) )
|
||||||
file.deleteOnExit();
|
{
|
||||||
|
// 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" );
|
||||||
|
}
|
||||||
|
javadocDirectory.mkdirs();
|
||||||
|
|
||||||
|
File file = new File( javadocDirectory, "files" );
|
||||||
|
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();
|
||||||
|
|
||||||
List arguments = new ArrayList();
|
List arguments = new ArrayList();
|
||||||
|
|
||||||
cmd.setWorkingDirectory( javadocDirectory.getAbsolutePath() );
|
cmd.setWorkingDirectory( javadocDirectory.getAbsolutePath() );
|
||||||
cmd.setExecutable( getJavadocPath() );
|
cmd.setExecutable( getJavadocPath() );
|
||||||
|
|
||||||
// General javadoc arguments
|
// General javadoc arguments
|
||||||
addArgIfNotEmpty( arguments, "-locale", quotedArgument( this.locale ) );
|
addArgIfNotEmpty( arguments, "-locale", quotedArgument( this.locale ) );
|
||||||
addArgIf( arguments, breakiterator, "-breakiterator", 1.4f );
|
addArgIf( arguments, breakiterator, "-breakiterator", 1.4f );
|
||||||
if ( !StringUtils.isEmpty( doclet ) )
|
if ( !StringUtils.isEmpty( doclet ) )
|
||||||
|
{
|
||||||
|
addArgIfNotEmpty( arguments, "-doclet", quotedArgument( doclet ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-docletPath", quotedPathArgument( docletPath ) );
|
||||||
|
}
|
||||||
|
addArgIfNotEmpty( arguments, "-encoding", quotedArgument( encoding ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-extdirs", quotedPathArgument( extdirs ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-exclude", quotedArgument( excludePackageNames ), 1.4f );
|
||||||
|
if ( !StringUtils.isEmpty( maxmemory ) )
|
||||||
|
{
|
||||||
|
// Allow '128' or '128m'
|
||||||
|
if ( NumberUtils.isDigits( maxmemory ) )
|
||||||
{
|
{
|
||||||
addArgIfNotEmpty( arguments, "-doclet", quotedArgument( doclet ) );
|
addArgIf( arguments, true, "-J-Xmx" + maxmemory + "m" );
|
||||||
addArgIfNotEmpty( arguments, "-docletPath", quotedPathArgument( docletPath ) );
|
|
||||||
}
|
|
||||||
addArgIfNotEmpty( arguments, "-encoding", quotedArgument( encoding ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-extdirs", quotedPathArgument( extdirs ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-exclude", quotedArgument( excludePackageNames ), 1.4f );
|
|
||||||
if ( !StringUtils.isEmpty( maxmemory ) )
|
|
||||||
{
|
|
||||||
// Allow '128' or '128m'
|
|
||||||
if ( NumberUtils.isDigits( maxmemory ) )
|
|
||||||
{
|
|
||||||
addArgIf( arguments, true, "-J-Xmx" + maxmemory + "m" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( ( NumberUtils.isDigits( maxmemory.substring( 0, maxmemory.length() - 1 ) ) ) &&
|
|
||||||
( maxmemory.toLowerCase().endsWith( "m" ) ) )
|
|
||||||
{
|
|
||||||
addArgIf( arguments, true, "-J-Xmx" + maxmemory );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getLog().error(
|
|
||||||
"The maxmemory '" + maxmemory + "' is not a valid number. Ignore this option." );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !StringUtils.isEmpty( minmemory ) )
|
|
||||||
{
|
|
||||||
// Allow '128' or '128m'
|
|
||||||
if ( NumberUtils.isDigits( minmemory ) )
|
|
||||||
{
|
|
||||||
addArgIf( arguments, true, "-J-Xms" + minmemory + "m" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( ( NumberUtils.isDigits( minmemory.substring( 0, minmemory.length() - 1 ) ) ) &&
|
|
||||||
( minmemory.toLowerCase().endsWith( "m" ) ) )
|
|
||||||
{
|
|
||||||
addArgIf( arguments, true, "-J-Xms" + minmemory );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
getLog().error(
|
|
||||||
"The minmemory '" + minmemory + "' is not a valid number. Ignore this option." );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( old && SystemUtils.isJavaVersionAtLeast( 1.4f ) )
|
|
||||||
{
|
|
||||||
getLog().warn( "Javadoc 1.4 doesn't support the -1.1 switch anymore. Ignore this option." );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
addArgIf( arguments, old, "-1.1" );
|
if ( ( NumberUtils.isDigits( maxmemory.substring( 0, maxmemory.length() - 1 ) ) ) &&
|
||||||
}
|
( maxmemory.toLowerCase().endsWith( "m" ) ) )
|
||||||
|
|
||||||
addArgIfNotEmpty( arguments, "-overview", quotedArgument( overview ) );
|
|
||||||
addArgIf( arguments, showPackage, "-package" );
|
|
||||||
addArgIf( arguments, showPrivate, "-private" );
|
|
||||||
addArgIf( arguments, showProtected, "-protected" );
|
|
||||||
addArgIf( arguments, public_, "-public" );
|
|
||||||
addArgIf( arguments, quiet, "-quiet", 1.4f );
|
|
||||||
addArgIfNotEmpty( arguments, "-source", quotedArgument( source ), 1.4f );
|
|
||||||
addArgIf( arguments, verbose, "-verbose" );
|
|
||||||
addArgIfNotEmpty( arguments, "-additionalparam", quotedArgument( additionalparam ) );
|
|
||||||
|
|
||||||
addArgIfNotEmpty( arguments, "-sourcePath", quotedPathArgument( sourcePath.toString() ) );
|
|
||||||
|
|
||||||
// javadoc arguments for default doclet
|
|
||||||
if ( StringUtils.isEmpty( doclet ) )
|
|
||||||
{
|
|
||||||
bottom = StringUtils.replace( bottom, "{currentYear}", year );
|
|
||||||
if ( project.getInceptionYear() != null )
|
|
||||||
{
|
{
|
||||||
bottom = StringUtils.replace( bottom, "{inceptionYear}", project.getInceptionYear() );
|
addArgIf( arguments, true, "-J-Xmx" + maxmemory );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bottom = StringUtils.replace( bottom, "{inceptionYear}-", "" );
|
getLog().error( "The maxmemory '" + maxmemory + "' is not a valid number. Ignore this option." );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( StringUtils.isEmpty( stylesheetfile ) )
|
|
||||||
{
|
|
||||||
stylesheetfile = javadocDirectory + File.separator + DEFAULT_CSS_NAME;
|
|
||||||
}
|
|
||||||
// End Specify default values
|
|
||||||
|
|
||||||
addArgIf( arguments, author, "-author" );
|
|
||||||
addArgIfNotEmpty( arguments, "-bottom", quotedArgument( bottom ) );
|
|
||||||
addArgIf( arguments, breakiterator, "-breakiterator", 1.4f );
|
|
||||||
addArgIfNotEmpty( arguments, "-charset", quotedArgument( charset ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-d", quotedPathArgument( javadocDirectory.toString() ) );
|
|
||||||
addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", 1.4f );
|
|
||||||
addArgIfNotEmpty( arguments, "-docencoding", quotedArgument( docencoding ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-doctitle", quotedArgument( doctitle ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-excludedocfilessubdir", quotedPathArgument( excludedocfilessubdir ),
|
|
||||||
1.4f );
|
|
||||||
addArgIfNotEmpty( arguments, "-footer", quotedArgument( footer ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-group", quotedArgument( group ), true );
|
|
||||||
addArgIfNotEmpty( arguments, "-header", quotedArgument( header ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-helpfile", quotedPathArgument( helpfile ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-link", quotedPathArgument( link ), true );
|
|
||||||
addArgIfNotEmpty( arguments, "-linkoffline", quotedPathArgument( linkoffline ), true );
|
|
||||||
addArgIf( arguments, linksource, "-linksource", 1.4f );
|
|
||||||
addArgIf( arguments, nodeprecated, "-nodeprecated" );
|
|
||||||
addArgIf( arguments, nodeprecatedlist, "-nodeprecatedlist" );
|
|
||||||
addArgIf( arguments, nocomment, "-nocomment", 1.4f );
|
|
||||||
addArgIf( arguments, nohelp, "-nohelp" );
|
|
||||||
addArgIf( arguments, noindex, "-noindex" );
|
|
||||||
addArgIf( arguments, nonavbar, "-nonavbar" );
|
|
||||||
addArgIfNotEmpty( arguments, "-noqualifier", quotedArgument( noqualifier ), 1.4f );
|
|
||||||
addArgIf( arguments, nosince, "-nosince" );
|
|
||||||
addArgIf( arguments, notree, "-notree" );
|
|
||||||
addArgIf( arguments, serialwarn, "-serialwarn" );
|
|
||||||
addArgIf( arguments, splitindex, "-splitindex" );
|
|
||||||
addArgIfNotEmpty( arguments, "-stylesheetfile", quotedPathArgument( stylesheetfile ) );
|
|
||||||
addArgIfNotEmpty( arguments, "-tag", quotedArgument( tag ), 1.4f, true );
|
|
||||||
addArgIfNotEmpty( arguments, "-taglet", quotedArgument( taglet ), 1.4f );
|
|
||||||
addArgIfNotEmpty( arguments, "-tagletpath", quotedPathArgument( tagletpath ), 1.4f );
|
|
||||||
addArgIf( arguments, use, "-use" );
|
|
||||||
addArgIf( arguments, version, "-version" );
|
|
||||||
addArgIfNotEmpty( arguments, "-windowtitle", quotedArgument( windowtitle ) );
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( options.length() > 0 )
|
if ( !StringUtils.isEmpty( minmemory ) )
|
||||||
|
{
|
||||||
|
// Allow '128' or '128m'
|
||||||
|
if ( NumberUtils.isDigits( minmemory ) )
|
||||||
{
|
{
|
||||||
File optionsFile = new File( javadocDirectory, "options" );
|
addArgIf( arguments, true, "-J-Xms" + minmemory + "m" );
|
||||||
for ( Iterator it = arguments.iterator(); it.hasNext(); )
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( ( NumberUtils.isDigits( minmemory.substring( 0, minmemory.length() - 1 ) ) ) &&
|
||||||
|
( minmemory.toLowerCase().endsWith( "m" ) ) )
|
||||||
{
|
{
|
||||||
options.append( " " );
|
addArgIf( arguments, true, "-J-Xms" + minmemory );
|
||||||
options.append( (String) it.next() );
|
|
||||||
}
|
}
|
||||||
FileUtils.fileWrite( optionsFile.getAbsolutePath(), options.toString() );
|
else
|
||||||
cmd.createArgument().setValue( "@options" );
|
{
|
||||||
optionsFile.deleteOnExit();
|
getLog().error( "The minmemory '" + minmemory + "' is not a valid number. Ignore this option." );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( old && SystemUtils.isJavaVersionAtLeast( 1.4f ) )
|
||||||
|
{
|
||||||
|
getLog().warn( "Javadoc 1.4 doesn't support the -1.1 switch anymore. Ignore this option." );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
addArgIf( arguments, old, "-1.1" );
|
||||||
|
}
|
||||||
|
|
||||||
|
addArgIfNotEmpty( arguments, "-overview", quotedArgument( overview ) );
|
||||||
|
addArgIf( arguments, showPackage, "-package" );
|
||||||
|
addArgIf( arguments, showPrivate, "-private" );
|
||||||
|
addArgIf( arguments, showProtected, "-protected" );
|
||||||
|
addArgIf( arguments, public_, "-public" );
|
||||||
|
addArgIf( arguments, quiet, "-quiet", 1.4f );
|
||||||
|
addArgIfNotEmpty( arguments, "-source", quotedArgument( source ), 1.4f );
|
||||||
|
addArgIf( arguments, verbose, "-verbose" );
|
||||||
|
addArgIfNotEmpty( arguments, "-additionalparam", quotedArgument( additionalparam ) );
|
||||||
|
|
||||||
|
addArgIfNotEmpty( arguments, "-sourcePath", quotedPathArgument( sourcePath.toString() ) );
|
||||||
|
|
||||||
|
// javadoc arguments for default doclet
|
||||||
|
if ( StringUtils.isEmpty( doclet ) )
|
||||||
|
{
|
||||||
|
bottom = StringUtils.replace( bottom, "{currentYear}", year );
|
||||||
|
if ( project.getInceptionYear() != null )
|
||||||
|
{
|
||||||
|
bottom = StringUtils.replace( bottom, "{inceptionYear}", project.getInceptionYear() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bottom = StringUtils.replace( bottom, "{inceptionYear}-", "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.createArgument().setValue( "@files" );
|
if ( StringUtils.isEmpty( stylesheetfile ) )
|
||||||
|
{
|
||||||
|
stylesheetfile = javadocDirectory + File.separator + DEFAULT_CSS_NAME;
|
||||||
|
}
|
||||||
|
// End Specify default values
|
||||||
|
|
||||||
getLog().info( Commandline.toString( cmd.getCommandline() ) );
|
addArgIf( arguments, author, "-author" );
|
||||||
|
addArgIfNotEmpty( arguments, "-bottom", quotedArgument( bottom ) );
|
||||||
|
addArgIf( arguments, breakiterator, "-breakiterator", 1.4f );
|
||||||
|
addArgIfNotEmpty( arguments, "-charset", quotedArgument( charset ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-d", quotedPathArgument( javadocDirectory.toString() ) );
|
||||||
|
addArgIf( arguments, docfilessubdirs, "-docfilessubdirs", 1.4f );
|
||||||
|
addArgIfNotEmpty( arguments, "-docencoding", quotedArgument( docencoding ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-doctitle", quotedArgument( doctitle ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-excludedocfilessubdir", quotedPathArgument( excludedocfilessubdir ), 1.4f );
|
||||||
|
addArgIfNotEmpty( arguments, "-footer", quotedArgument( footer ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-group", quotedArgument( group ), true );
|
||||||
|
addArgIfNotEmpty( arguments, "-header", quotedArgument( header ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-helpfile", quotedPathArgument( helpfile ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-link", quotedPathArgument( link ), true );
|
||||||
|
addArgIfNotEmpty( arguments, "-linkoffline", quotedPathArgument( linkoffline ), true );
|
||||||
|
addArgIf( arguments, linksource, "-linksource", 1.4f );
|
||||||
|
addArgIf( arguments, nodeprecated, "-nodeprecated" );
|
||||||
|
addArgIf( arguments, nodeprecatedlist, "-nodeprecatedlist" );
|
||||||
|
addArgIf( arguments, nocomment, "-nocomment", 1.4f );
|
||||||
|
addArgIf( arguments, nohelp, "-nohelp" );
|
||||||
|
addArgIf( arguments, noindex, "-noindex" );
|
||||||
|
addArgIf( arguments, nonavbar, "-nonavbar" );
|
||||||
|
addArgIfNotEmpty( arguments, "-noqualifier", quotedArgument( noqualifier ), 1.4f );
|
||||||
|
addArgIf( arguments, nosince, "-nosince" );
|
||||||
|
addArgIf( arguments, notree, "-notree" );
|
||||||
|
addArgIf( arguments, serialwarn, "-serialwarn" );
|
||||||
|
addArgIf( arguments, splitindex, "-splitindex" );
|
||||||
|
addArgIfNotEmpty( arguments, "-stylesheetfile", quotedPathArgument( stylesheetfile ) );
|
||||||
|
addArgIfNotEmpty( arguments, "-tag", quotedArgument( tag ), 1.4f, true );
|
||||||
|
addArgIfNotEmpty( arguments, "-taglet", quotedArgument( taglet ), 1.4f );
|
||||||
|
addArgIfNotEmpty( arguments, "-tagletpath", quotedPathArgument( tagletpath ), 1.4f );
|
||||||
|
addArgIf( arguments, use, "-use" );
|
||||||
|
addArgIf( arguments, version, "-version" );
|
||||||
|
addArgIfNotEmpty( arguments, "-windowtitle", quotedArgument( windowtitle ) );
|
||||||
|
}
|
||||||
|
|
||||||
int exitCode = CommandLineUtils.executeCommandLine( cmd, new DefaultConsumer(), new DefaultConsumer() );
|
if ( options.length() > 0 )
|
||||||
|
{
|
||||||
|
File optionsFile = new File( javadocDirectory, "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 )
|
||||||
|
{
|
||||||
|
throw new MavenReportException( "Unable to write temporary file for command execution", e );
|
||||||
|
}
|
||||||
|
cmd.createArgument().setValue( "@options" );
|
||||||
|
optionsFile.deleteOnExit();
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.createArgument().setValue( "@files" );
|
||||||
|
|
||||||
|
getLog().info( Commandline.toString( cmd.getCommandline() ) );
|
||||||
|
|
||||||
|
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.
|
||||||
|
@ -150,7 +151,7 @@ public class SiteMojo
|
||||||
/**
|
/**
|
||||||
* Internationalization.
|
* Internationalization.
|
||||||
*
|
*
|
||||||
* @component
|
* @component
|
||||||
*/
|
*/
|
||||||
private I18N i18n;
|
private I18N i18n;
|
||||||
|
|
||||||
|
@ -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