[
http://jira.codehaus.org/browse/MCOMPILER-135?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=235198#action_235198
]
Sean Patrick Floyd commented on MCOMPILER-135:
----------------------------------------------
Per: have a look at {code}javac -help{code}
{noformat}
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are
used
-classpath <path> Specify where to find user class files and
annotation processors
-cp <path> Specify where to find user class files and
annotation processors
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or
compilation is done.
-processor <class1>[,<class2>,<class3>...]Names of the annotation processors
to run; bypasses default discovery process
-processorpath <path> Specify where to find annotation processors
-d <directory> Specify where to place generated class files
-s <directory> Specify where to place generated source files
-implicit:{none,class} Specify whether or not to generate class files for
implicitly referenced files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-Akey[=value] Options to pass to annotation processors
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
{noformat}
You can see that almost all parameters are either of the form "-parameter" or
"-parameter value" (your example "-verbose=true" throws an error, the usage is
"-verbose"). There are only a few exceptions to this rule, and -Akey=value is
one of them. Some of the other exceptions are already handled (like
[proc:|http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#proc]).
> Passing multiple parameters to Java 6 annotation processors with javac does
> not work
> ------------------------------------------------------------------------------------
>
> Key: MCOMPILER-135
> URL: http://jira.codehaus.org/browse/MCOMPILER-135
> Project: Maven 2.x Compiler Plugin
> Issue Type: Bug
> Affects Versions: 2.3.1
> Environment: JDK 1.6, Maven 2.2.1, Maven-Compiler-Plugin 2.3.1,
> Windows
> Reporter: Sean Patrick Floyd
> Attachments: AbstractCompilerMojo.java.2.patch,
> AbstractCompilerMojo.java.patch
>
>
> I have an annotation processor that supports multiple parameters and I have
> found that there is no way to set more than one of them at any given time
> from the Maven Compiler Plugin,
> Here's my setup.
> {code:xml}
> <plugin>
> <inherited>true</inherited>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.3.1</version>
> <configuration>
> <source>1.6</source>
> <target>1.6</target>
> <compilerArgument>-AaddResDir=src/main/webapp
> -Averbose=true</compilerArgument>
> </configuration>
> </plugin>
> {code}
> Javac needs the parameters added as separate Strings
> {code}[ ... , "-AaddResDir=src/main/webapp", "-Averbose=true"]{code}
> but the Compiler Plugin generates this code:
> {code}[ ... , "-AaddResDir=src/main/webapp -Averbose=true"]{code}
> which Javac will parse as
> {code}key:"addResDir" value="src/main/webapp -Averbose=true"{code}
> The map version "<compilerArguments>" is of no help either, because this
> {code}<Averbose>true</Averbose>
> <AaddResDir>src/main/webapp</AResDir>{code}
> will generate the output
> {code}[... , "-Averbose", "true", "-AaddResDir", "src/main/webapp"]{code}
> while this
> {code}<Averbose=true />
> <AaddResDir=src/main/webapp />{code}
> is not well-formed XML.
> Stepping through the compiler argument generation with the debugger I have
> not found a way to post-process the arguments, so please add a way to support
> multiple APT parameters because this is a major show-stopper.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira