You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2010/02/08 18:21:40 UTC
svn commit: r907730 -
/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
Author: jdcasey
Date: Mon Feb 8 17:21:39 2010
New Revision: 907730
URL: http://svn.apache.org/viewvc?rev=907730&view=rev
Log:
[MCOMPILER-118] Separate compiler warnings from errors when failOnError == true.
Modified:
maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
Modified: maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java?rev=907730&r1=907729&r2=907730&view=diff
==============================================================================
--- maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java (original)
+++ maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java Mon Feb 8 17:21:39 2010
@@ -576,35 +576,50 @@
throw new MojoExecutionException( "Fatal error compiling", e );
}
- boolean compilationError = false;
-
+ List<CompilerError> warnings = new ArrayList<CompilerError>();
+ List<CompilerError> errors = new ArrayList<CompilerError>();
if ( messages != null )
{
for ( CompilerError message : messages )
{
if ( message.isError() )
{
- compilationError = true;
- break;
+ errors.add( message );
+ }
+ else
+ {
+ warnings.add( message );
}
}
}
- if ( compilationError && failOnError )
+ if ( failOnError && !errors.isEmpty() )
{
- getLog().info( "-------------------------------------------------------------" );
- getLog().error( "COMPILATION ERROR : " );
- getLog().info( "-------------------------------------------------------------" );
- if ( messages != null )
+ if ( !warnings.isEmpty() )
{
- for ( CompilerError message : messages )
+ getLog().info( "-------------------------------------------------------------" );
+ getLog().warn( "COMPILATION WARNING : " );
+ getLog().info( "-------------------------------------------------------------" );
+ for ( CompilerError warning : warnings )
{
- getLog().error( message.toString() );
+ getLog().warn( warning.toString() );
}
- getLog().info( messages.size() + ( ( messages.size() > 1 ) ? " errors " : "error" ) );
+ getLog().info( warnings.size() + ( ( warnings.size() > 1 ) ? " warnings " : "warning" ) );
getLog().info( "-------------------------------------------------------------" );
}
- throw new CompilationFailureException( messages );
+
+ getLog().info( "-------------------------------------------------------------" );
+ getLog().error( "COMPILATION ERROR : " );
+ getLog().info( "-------------------------------------------------------------" );
+
+ for ( CompilerError error : errors )
+ {
+ getLog().error( error.toString() );
+ }
+ getLog().info( errors.size() + ( ( errors.size() > 1 ) ? " errors " : "error" ) );
+ getLog().info( "-------------------------------------------------------------" );
+
+ throw new CompilationFailureException( errors );
}
else
{