// ----------------------------------------------------------------------
// Create command line for Javadoc
// ----------------------------------------------------------------------
Commandline cmd = new Commandline();
cmd.getShell().setQuotedArgumentsEnabled( false ); // for Javadoc JVM args
cmd.setWorkingDirectory( javadocOutputDirectory.getAbsolutePath() );
cmd.setExecutable( jExecutable );
// ----------------------------------------------------------------------
// Wrap Javadoc JVM args
// ----------------------------------------------------------------------
addMemoryArg( cmd, "-Xmx", this.maxmemory );
addMemoryArg( cmd, "-Xms", this.minmemory );
addProxyArg( cmd );
if ( StringUtils.isNotEmpty( additionalJOption ) )
{
cmd.createArg().setValue( additionalJOption );
}
if ( additionalJOptions != null && additionalJOptions.length != 0 )
{
for ( String jo : additionalJOptions )
{
cmd.createArg().setValue( jo );
}
}
List<String> arguments = new ArrayList<String>();
// ----------------------------------------------------------------------
// Wrap Javadoc options
// ----------------------------------------------------------------------
addJavadocOptions( arguments, sourcePaths );
// ----------------------------------------------------------------------
// Wrap Standard doclet Options
// ----------------------------------------------------------------------
if ( StringUtils.isEmpty( doclet ) || useStandardDocletOptions )
{
addStandardDocletOptions( javadocOutputDirectory, arguments );
}
// ----------------------------------------------------------------------
// Write options file and include it in the command line
// ----------------------------------------------------------------------
if ( arguments.size() > 0 )
{
addCommandLineOptions( cmd, arguments, javadocOutputDirectory );
}
// ----------------------------------------------------------------------
// Write packages file and include it in the command line
// ----------------------------------------------------------------------
if ( !packageNames.isEmpty() )
{
addCommandLinePackages( cmd, javadocOutputDirectory, packageNames );
// ----------------------------------------------------------------------
// Write argfile file and include it in the command line
// ----------------------------------------------------------------------
if ( !filesWithUnnamedPackages.isEmpty() )
{
addCommandLineArgFile( cmd, javadocOutputDirectory, filesWithUnnamedPackages );
}
}
else
{
// ----------------------------------------------------------------------
// Write argfile file and include it in the command line
// ----------------------------------------------------------------------
if ( !files.isEmpty() )
{
addCommandLineArgFile( cmd, javadocOutputDirectory, files );
}
}
// ----------------------------------------------------------------------
// Execute command line
// ----------------------------------------------------------------------
executeJavadocCommandLine( cmd, javadocOutputDirectory );
// delete generated javadoc files only if no error and no debug mode
// [MJAVADOC-336] Use File.delete() instead of File.deleteOnExit() to
// prevent these files from making their way into archives.
if ( !debug )
{
for ( int i = 0; i < cmd.getArguments().length; i++ )
{
String arg = cmd.getArguments()[i].trim();
if ( !arg.startsWith( "@" ) )
{
continue;
}