From b4cbc025678934cebce3148abaafa7b286017e96 Mon Sep 17 00:00:00 2001 From: Trygve Laugstol Date: Sat, 6 Aug 2005 12:36:48 +0000 Subject: [PATCH] o Adding parameters: - Show deprecation - Show warnings o Using the setters on the configuration object instead of passing them in their raw format (eg -target 1.1). git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@230547 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven/plugin/AbstractCompilerMojo.java | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java index 6ac161e907..5bffa7ddbd 100644 --- a/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java +++ b/maven-plugins/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java @@ -44,6 +44,20 @@ public abstract class AbstractCompilerMojo */ private boolean debug; + /** + * Output source locations where deprecated APIs are used + * + * @parameter + */ + private boolean showDeprecation; + + /** + * Output warnings + * + * @parameter + */ + private boolean showWarnings; + /** * The -source argument for the Java compiler * @@ -130,23 +144,18 @@ public abstract class AbstractCompilerMojo compilerConfiguration.setSourceFiles( staleSources ); } - if ( source != null ) - { - compilerConfiguration.addCompilerOption( "-source", source ); - } - - if ( target != null ) - { - compilerConfiguration.addCompilerOption( "-target", target ); - } - - if ( encoding != null ) - { - compilerConfiguration.addCompilerOption( "-encoding" , encoding ); - } - compilerConfiguration.setDebug( debug ); + compilerConfiguration.setShowDeprecation( showDeprecation ); + + compilerConfiguration.setShowWarnings( showWarnings ); + + compilerConfiguration.setSourceVersion( source ); + + compilerConfiguration.setTargetVersion( target ); + + compilerConfiguration.setSourceEncoding( encoding ); + // ---------------------------------------------------------------------- // Dump configuration // ---------------------------------------------------------------------- @@ -189,7 +198,7 @@ public abstract class AbstractCompilerMojo throw new MojoExecutionException( "No such compiler '" + e.getCompilerId() + "'." ); } - getLog().info( "Using compiler '" + compilerId + "'." ); + getLog().debug( "Using compiler '" + compilerId + "'." ); try {