mirror of https://github.com/apache/maven.git
don't attempt and fail to compile when there is no sources
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163632 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f5410a596f
commit
1612049e44
|
@ -29,6 +29,7 @@ import java.io.OutputStream;
|
|||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -55,10 +56,23 @@ public class JavacCompiler
|
|||
|
||||
String[] sources = getSourceFiles( config );
|
||||
|
||||
if ( sources.length == 0 )
|
||||
{
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
System.out.println( "Compiling " + sources.length + " source file" + ( sources.length == 1 ? "" : "s" )
|
||||
+ " to " + destinationDir.getAbsolutePath() );
|
||||
|
||||
Map compilerOptions = config.getCompilerOptions();
|
||||
|
||||
List args = new ArrayList( sources.length + 5 + compilerOptions.size() * 2 );
|
||||
|
||||
if ( config.isDebug() )
|
||||
{
|
||||
args.add( "-g" );
|
||||
}
|
||||
|
||||
args.add( "-d" );
|
||||
|
||||
args.add( destinationDir.getAbsolutePath() );
|
||||
|
@ -69,11 +83,6 @@ public class JavacCompiler
|
|||
|
||||
args.add( getClasspathString( config.getClasspathEntries() ) );
|
||||
|
||||
if ( config.isDebug() )
|
||||
{
|
||||
args.add( "-g" );
|
||||
}
|
||||
|
||||
Iterator it = compilerOptions.entrySet().iterator();
|
||||
|
||||
while ( it.hasNext() )
|
||||
|
@ -109,7 +118,7 @@ public class JavacCompiler
|
|||
|
||||
if ( !ok.booleanValue() )
|
||||
{
|
||||
throw new Exception( "Failure executing javac: \n\t" + err.toString() );
|
||||
throw new Exception( "Failure executing javac: \n\n'javac " + args + "'\n\n" + err.toString() );
|
||||
}
|
||||
|
||||
List messages = parseModernStream( new BufferedReader( new InputStreamReader( new ByteArrayInputStream( err.toByteArray() ) ) ) );
|
||||
|
|
Loading…
Reference in New Issue