Author: carlos
Date: Tue Dec 27 13:41:24 2005
New Revision: 359288

URL: http://svn.apache.org/viewcvs?rev=359288&view=rev
Log:
Added compilerArgument
PR: MCOMPILER-23

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/viewcvs/maven/plugins/trunk/maven-compiler-plugin/src/main/java/org/apache/maven/plugin/AbstractCompilerMojo.java?rev=359288&r1=359287&r2=359288&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
 Tue Dec 27 13:41:24 2005
@@ -166,16 +166,32 @@
     private String executable;
 
     /**
-     * Arguments to be passed to the compiler if fork is set to true.
-     * <p/>
+     * <p>
+     * Arguments to be passed to the compiler (prepending a dash) if fork is 
set to true.
+     * </p>
+     * <p>
      * This is because the list of valid arguments passed to a Java compiler
      * varies based on the compiler version.
+     * </p>
      *
      * @parameter
      */
     private Map compilerArguments;
 
     /**
+     * <p>
+     * Unformatted argument string to be passed to the compiler if fork is set 
to true.
+     * </p>
+     * <p>
+     * This is because the list of valid arguments passed to a Java compiler
+     * varies based on the compiler version.
+     * </p>
+     *
+     * @parameter
+     */
+    private String compilerArgument;
+
+    /**
      * Used to control the name of the output file when compiling a set of
      * sources to a single file.
      *
@@ -292,25 +308,26 @@
 
         compilerConfiguration.setSourceEncoding( encoding );
 
-        if ( compilerArguments != null )
+        if (( compilerArguments != null ) || ( compilerArgument != null ))
         {
             LinkedHashMap cplrArgsCopy = new LinkedHashMap();
-            for ( Iterator i = compilerArguments.entrySet().iterator(); 
i.hasNext(); )
+            if ( compilerArguments != null )
             {
-                Map.Entry me = (Map.Entry) i.next();
-                String key = (String) me.getKey();
-                String value = (String) me.getValue();
-                if ( !key.startsWith( "-" ))
+                for ( Iterator i = compilerArguments.entrySet().iterator(); 
i.hasNext(); )
                 {
-                    key = "-" + key;
+                    Map.Entry me = (Map.Entry) i.next();
+                    String key = (String) me.getKey();
+                    String value = (String) me.getValue();
+                    if ( !key.startsWith( "-" ))
+                    {
+                        key = "-" + key;
+                    }
+                    cplrArgsCopy.put( key, value );
                 }
-                /* handle Xlint like parameters */
-                if ( value.startsWith( ":" ))
-                {
-                    key += value;
-                    value = null;
-                }
-                cplrArgsCopy.put( key, value );
+            }
+            if ( !StringUtils.isEmpty( compilerArgument) )
+            {
+                cplrArgsCopy.put( compilerArgument, null );
             }
             compilerConfiguration.setCustomCompilerArguments( cplrArgsCopy );
         }


Reply via email to