You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Juven Xu (JIRA)" <ji...@codehaus.org> on 2010/05/26 11:34:12 UTC
[jira] Created: (MCOMPILER-129) unable to pass in javac -J option
unable to pass in javac -J option
---------------------------------
Key: MCOMPILER-129
URL: http://jira.codehaus.org/browse/MCOMPILER-129
Project: Maven 2.x Compiler Plugin
Issue Type: Bug
Affects Versions: 2.3.1
Environment: jdk 1.6
maven 3.0-beta-1
Reporter: Juven Xu
because of MCOMPILER-109, l10n-ed javac warning messages will be regarded as error, so I want to pass user language configuration to javac, like this:
javac ... -J-Duser.language=en_us
this works well on pure javac command line, but when I configure this for maven-compiler-plugin:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<fork>true</fork>
<source>1.5</source>
<target>1.5</target>
<compilerArgument>-J-Duser.language=en_us</compilerArgument>
</configuration>
</plugin>
I got:
[DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile' with basic configurator -->
[DEBUG] (f) basedir = D:\workspace\test
[DEBUG] (f) buildDirectory = D:\workspace\test\target
[DEBUG] (f) classpathElements = [D:\workspace\test\target\classes]
[DEBUG] (f) compileSourceRoots = [D:\workspace\test\src\main\java]
[DEBUG] (f) compilerArgument = -J-Duser.language=en_us
[DEBUG] (f) compilerId = javac
[DEBUG] (f) debug = true
[DEBUG] (f) failOnError = true
[DEBUG] (f) fork = true
[DEBUG] (f) generatedSourcesDirectory = D:\workspace\test\target\generated-sources\annotations
[DEBUG] (f) optimize = false
[DEBUG] (f) outputDirectory = D:\workspace\test\target\classes
[DEBUG] (f) outputFileName = test-0.0.1-SNAPSHOT
[DEBUG] (f) projectArtifact = com.juvenxu:test:jar:0.0.1-SNAPSHOT
[DEBUG] (f) session = org.apache.maven.execution.MavenSession@11d2572
[DEBUG] (f) showDeprecation = false
[DEBUG] (f) showWarnings = false
[DEBUG] (f) source = 1.5
[DEBUG] (f) staleMillis = 0
[DEBUG] (f) target = 1.5
[DEBUG] (f) verbose = false
[DEBUG] -- end configuration --
[DEBUG] Using compiler 'javac'.
[DEBUG] Source directories: [D:\workspace\test\src\main\java]
[DEBUG] Classpath: [D:\workspace\test\target\classes]
[DEBUG] Output directory: D:\workspace\test\target\classes
[DEBUG] Classpath:
[DEBUG] D:\workspace\test\target\classes
[DEBUG] Source roots:
[DEBUG] D:\workspace\test\src\main\java
[DEBUG] Command line options:
[DEBUG] -d D:\workspace\test\target\classes -classpath D:\workspace\test\target\classes; -sourcepath D:\workspace\test\src\main\java; D:\workspace\test\src\main\java\com\juvenxu\test\Test.java -g -nowarn -target 1.5 -source 1.5 -J-Duser.language=en_us
[WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
[INFO] Compiling 1 source file to D:\workspace\test\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Failure executing javac, but could not parse the error:
javac: 无效的标志: -J-Duser.language=en_us
用法: javac <options> <source files>
-help 用于列出可能的选项
[INFO] 1error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.451s
[INFO] Finished at: Wed May 26 17:29:06 CST 2010
[INFO] Final Memory: 2M/5M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project test: Compilation failure
Failure executing javac, but could not parse the error:
javac: 无效的标志: -J-Duser.language=en_us
用法: javac <options> <source files>
-help 用于列出可能的选项
-> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project test: Compilation failure
Failure executing javac, but could not parse the error:
javac: 无效的标志: -J-Duser.language=en_us
用法: javac <options> <source files>
-help 用于列出可能的选项
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:581)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
Failure executing javac, but could not parse the error:
javac: 无效的标志: -J-Duser.language=en_us
用法: javac <options> <source files>
-help 用于列出可能的选项
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)
... 14 more
[ERROR]
--
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
[jira] Issue Comment Edited: (MCOMPILER-129) unable to pass in
javac -J option
Posted by "Robert Scholte (JIRA)" <ji...@codehaus.org>.
[ https://jira.codehaus.org/browse/MCOMPILER-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=277234#comment-277234 ]
Robert Scholte edited comment on MCOMPILER-129 at 8/27/11 5:19 PM:
-------------------------------------------------------------------
One way to solve this is by using {{compilerArguments}} like this:
{code:xml}
<compilerArguments>
<J-Duser.language>en_us</J-Duser.language>
</compilerArguments>
{code}
This works because the plugin will prefix the key with a '{{-}}' if it's not there.
There real problem is caused by this piece of code:
{code}
if ( !StringUtils.isEmpty( effectiveCompilerArgument ) )
{
cplrArgsCopy.put( effectiveCompilerArgument, null );
}
{code}
Here the whole line is set as the key without a specific value.
To solve this the line should be split into key-value pairs.
I´ve assigned this already issue to myself.
was (Author: rfscholte):
One way to solve this is by using {{compilerArguments}} like this:
{code:xml}
<compiletArguments>
<J-Duser.language>en_us</J-Duser.language>
</compiletArguments>
{code}
This works because the plugin will prefix the key with a '{{-}}' if it's not there.
There real problem is caused by this piece of code:
{code}
if ( !StringUtils.isEmpty( effectiveCompilerArgument ) )
{
cplrArgsCopy.put( effectiveCompilerArgument, null );
}
{code}
Here the whole line is set as the key without a specific value.
To solve this the line should be split into key-value pairs.
I´ve assigned this already issue to myself.
> unable to pass in javac -J option
> ---------------------------------
>
> Key: MCOMPILER-129
> URL: https://jira.codehaus.org/browse/MCOMPILER-129
> Project: Maven 2.x Compiler Plugin
> Issue Type: Bug
> Affects Versions: 2.3.1
> Environment: jdk 1.6
> maven 3.0-beta-1
> Reporter: Juven Xu
> Assignee: Robert Scholte
>
> because of MCOMPILER-109, l10n-ed javac warning messages will be regarded as error, so I want to pass user language configuration to javac, like this:
> javac ... -J-Duser.language=en_us
> this works well on pure javac command line, but when I configure this for maven-compiler-plugin:
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.3.1</version>
> <configuration>
> <fork>true</fork>
> <source>1.5</source>
> <target>1.5</target>
> <compilerArgument>-J-Duser.language=en_us</compilerArgument>
> </configuration>
> </plugin>
> I got:
> [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile' with basic configurator -->
> [DEBUG] (f) basedir = D:\workspace\test
> [DEBUG] (f) buildDirectory = D:\workspace\test\target
> [DEBUG] (f) classpathElements = [D:\workspace\test\target\classes]
> [DEBUG] (f) compileSourceRoots = [D:\workspace\test\src\main\java]
> [DEBUG] (f) compilerArgument = -J-Duser.language=en_us
> [DEBUG] (f) compilerId = javac
> [DEBUG] (f) debug = true
> [DEBUG] (f) failOnError = true
> [DEBUG] (f) fork = true
> [DEBUG] (f) generatedSourcesDirectory = D:\workspace\test\target\generated-sources\annotations
> [DEBUG] (f) optimize = false
> [DEBUG] (f) outputDirectory = D:\workspace\test\target\classes
> [DEBUG] (f) outputFileName = test-0.0.1-SNAPSHOT
> [DEBUG] (f) projectArtifact = com.juvenxu:test:jar:0.0.1-SNAPSHOT
> [DEBUG] (f) session = org.apache.maven.execution.MavenSession@11d2572
> [DEBUG] (f) showDeprecation = false
> [DEBUG] (f) showWarnings = false
> [DEBUG] (f) source = 1.5
> [DEBUG] (f) staleMillis = 0
> [DEBUG] (f) target = 1.5
> [DEBUG] (f) verbose = false
> [DEBUG] -- end configuration --
> [DEBUG] Using compiler 'javac'.
> [DEBUG] Source directories: [D:\workspace\test\src\main\java]
> [DEBUG] Classpath: [D:\workspace\test\target\classes]
> [DEBUG] Output directory: D:\workspace\test\target\classes
> [DEBUG] Classpath:
> [DEBUG] D:\workspace\test\target\classes
> [DEBUG] Source roots:
> [DEBUG] D:\workspace\test\src\main\java
> [DEBUG] Command line options:
> [DEBUG] -d D:\workspace\test\target\classes -classpath D:\workspace\test\target\classes; -sourcepath D:\workspace\test\src\main\java; D:\workspace\test\src\main\java\com\juvenxu\test\Test.java -g -nowarn -target 1.5 -source 1.5 -J-Duser.language=en_us
> [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
> [INFO] Compiling 1 source file to D:\workspace\test\target\classes
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR] Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> [INFO] 1error
> [INFO] -------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1.451s
> [INFO] Finished at: Wed May 26 17:29:06 CST 2010
> [INFO] Final Memory: 2M/5M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project test: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project test: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:581)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
> at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)
> ... 14 more
> [ERROR]
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (MCOMPILER-129) unable to pass in javac -J option
Posted by "Robert Scholte (JIRA)" <ji...@codehaus.org>.
[ https://jira.codehaus.org/browse/MCOMPILER-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=277235#comment-277235 ]
Robert Scholte commented on MCOMPILER-129:
------------------------------------------
I had to edit previous comment, because I made a typo in the configuration. Due to this it seemed to work, but it didn't.
The {{cplrArgsCopy}} which is passed to the Plexus Compiler separates the key and value with a space instead of a '='.
I've looked at its sourcecode and right now there's no way to specify which separator should be used.
So that brings us back to the original issue.
> unable to pass in javac -J option
> ---------------------------------
>
> Key: MCOMPILER-129
> URL: https://jira.codehaus.org/browse/MCOMPILER-129
> Project: Maven 2.x Compiler Plugin
> Issue Type: Bug
> Affects Versions: 2.3.1
> Environment: jdk 1.6
> maven 3.0-beta-1
> Reporter: Juven Xu
> Assignee: Robert Scholte
>
> because of MCOMPILER-109, l10n-ed javac warning messages will be regarded as error, so I want to pass user language configuration to javac, like this:
> javac ... -J-Duser.language=en_us
> this works well on pure javac command line, but when I configure this for maven-compiler-plugin:
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.3.1</version>
> <configuration>
> <fork>true</fork>
> <source>1.5</source>
> <target>1.5</target>
> <compilerArgument>-J-Duser.language=en_us</compilerArgument>
> </configuration>
> </plugin>
> I got:
> [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile' with basic configurator -->
> [DEBUG] (f) basedir = D:\workspace\test
> [DEBUG] (f) buildDirectory = D:\workspace\test\target
> [DEBUG] (f) classpathElements = [D:\workspace\test\target\classes]
> [DEBUG] (f) compileSourceRoots = [D:\workspace\test\src\main\java]
> [DEBUG] (f) compilerArgument = -J-Duser.language=en_us
> [DEBUG] (f) compilerId = javac
> [DEBUG] (f) debug = true
> [DEBUG] (f) failOnError = true
> [DEBUG] (f) fork = true
> [DEBUG] (f) generatedSourcesDirectory = D:\workspace\test\target\generated-sources\annotations
> [DEBUG] (f) optimize = false
> [DEBUG] (f) outputDirectory = D:\workspace\test\target\classes
> [DEBUG] (f) outputFileName = test-0.0.1-SNAPSHOT
> [DEBUG] (f) projectArtifact = com.juvenxu:test:jar:0.0.1-SNAPSHOT
> [DEBUG] (f) session = org.apache.maven.execution.MavenSession@11d2572
> [DEBUG] (f) showDeprecation = false
> [DEBUG] (f) showWarnings = false
> [DEBUG] (f) source = 1.5
> [DEBUG] (f) staleMillis = 0
> [DEBUG] (f) target = 1.5
> [DEBUG] (f) verbose = false
> [DEBUG] -- end configuration --
> [DEBUG] Using compiler 'javac'.
> [DEBUG] Source directories: [D:\workspace\test\src\main\java]
> [DEBUG] Classpath: [D:\workspace\test\target\classes]
> [DEBUG] Output directory: D:\workspace\test\target\classes
> [DEBUG] Classpath:
> [DEBUG] D:\workspace\test\target\classes
> [DEBUG] Source roots:
> [DEBUG] D:\workspace\test\src\main\java
> [DEBUG] Command line options:
> [DEBUG] -d D:\workspace\test\target\classes -classpath D:\workspace\test\target\classes; -sourcepath D:\workspace\test\src\main\java; D:\workspace\test\src\main\java\com\juvenxu\test\Test.java -g -nowarn -target 1.5 -source 1.5 -J-Duser.language=en_us
> [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
> [INFO] Compiling 1 source file to D:\workspace\test\target\classes
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR] Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> [INFO] 1error
> [INFO] -------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1.451s
> [INFO] Finished at: Wed May 26 17:29:06 CST 2010
> [INFO] Final Memory: 2M/5M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project test: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project test: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:581)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
> at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)
> ... 14 more
> [ERROR]
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (MCOMPILER-129) unable to pass in javac -J option
Posted by "Robert Scholte (JIRA)" <ji...@codehaus.org>.
[ https://jira.codehaus.org/browse/MCOMPILER-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=277234#comment-277234 ]
Robert Scholte commented on MCOMPILER-129:
------------------------------------------
One way to solve this is by using {{compilerArguments}} like this:
{code:xml}
<compiletArguments>
<J-Duser.language>en_us</J-Duser.language>
</compiletArguments>
{code}
This works because the plugin will prefix the key with a '{{-}}' if it's not there.
There real problem is caused by this piece of code:
{code}
if ( !StringUtils.isEmpty( effectiveCompilerArgument ) )
{
cplrArgsCopy.put( effectiveCompilerArgument, null );
}
{code}
Here the whole line is set as the key without a specific value.
To solve this the line should be split into key-value pairs.
I´ve assigned this already issue to myself.
> unable to pass in javac -J option
> ---------------------------------
>
> Key: MCOMPILER-129
> URL: https://jira.codehaus.org/browse/MCOMPILER-129
> Project: Maven 2.x Compiler Plugin
> Issue Type: Bug
> Affects Versions: 2.3.1
> Environment: jdk 1.6
> maven 3.0-beta-1
> Reporter: Juven Xu
> Assignee: Robert Scholte
>
> because of MCOMPILER-109, l10n-ed javac warning messages will be regarded as error, so I want to pass user language configuration to javac, like this:
> javac ... -J-Duser.language=en_us
> this works well on pure javac command line, but when I configure this for maven-compiler-plugin:
> <plugin>
> <artifactId>maven-compiler-plugin</artifactId>
> <version>2.3.1</version>
> <configuration>
> <fork>true</fork>
> <source>1.5</source>
> <target>1.5</target>
> <compilerArgument>-J-Duser.language=en_us</compilerArgument>
> </configuration>
> </plugin>
> I got:
> [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile' with basic configurator -->
> [DEBUG] (f) basedir = D:\workspace\test
> [DEBUG] (f) buildDirectory = D:\workspace\test\target
> [DEBUG] (f) classpathElements = [D:\workspace\test\target\classes]
> [DEBUG] (f) compileSourceRoots = [D:\workspace\test\src\main\java]
> [DEBUG] (f) compilerArgument = -J-Duser.language=en_us
> [DEBUG] (f) compilerId = javac
> [DEBUG] (f) debug = true
> [DEBUG] (f) failOnError = true
> [DEBUG] (f) fork = true
> [DEBUG] (f) generatedSourcesDirectory = D:\workspace\test\target\generated-sources\annotations
> [DEBUG] (f) optimize = false
> [DEBUG] (f) outputDirectory = D:\workspace\test\target\classes
> [DEBUG] (f) outputFileName = test-0.0.1-SNAPSHOT
> [DEBUG] (f) projectArtifact = com.juvenxu:test:jar:0.0.1-SNAPSHOT
> [DEBUG] (f) session = org.apache.maven.execution.MavenSession@11d2572
> [DEBUG] (f) showDeprecation = false
> [DEBUG] (f) showWarnings = false
> [DEBUG] (f) source = 1.5
> [DEBUG] (f) staleMillis = 0
> [DEBUG] (f) target = 1.5
> [DEBUG] (f) verbose = false
> [DEBUG] -- end configuration --
> [DEBUG] Using compiler 'javac'.
> [DEBUG] Source directories: [D:\workspace\test\src\main\java]
> [DEBUG] Classpath: [D:\workspace\test\target\classes]
> [DEBUG] Output directory: D:\workspace\test\target\classes
> [DEBUG] Classpath:
> [DEBUG] D:\workspace\test\target\classes
> [DEBUG] Source roots:
> [DEBUG] D:\workspace\test\src\main\java
> [DEBUG] Command line options:
> [DEBUG] -d D:\workspace\test\target\classes -classpath D:\workspace\test\target\classes; -sourcepath D:\workspace\test\src\main\java; D:\workspace\test\src\main\java\com\juvenxu\test\Test.java -g -nowarn -target 1.5 -source 1.5 -J-Duser.language=en_us
> [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
> [INFO] Compiling 1 source file to D:\workspace\test\target\classes
> [INFO] -------------------------------------------------------------
> [ERROR] COMPILATION ERROR :
> [INFO] -------------------------------------------------------------
> [ERROR] Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> [INFO] 1error
> [INFO] -------------------------------------------------------------
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 1.451s
> [INFO] Finished at: Wed May 26 17:29:06 CST 2010
> [INFO] Final Memory: 2M/5M
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project test: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project test: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:581)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:324)
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:247)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:104)
> at org.apache.maven.cli.MavenCli.execute(MavenCli.java:427)
> at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:157)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:121)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
> at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
> at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
> at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
> Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
> Failure executing javac, but could not parse the error:
> javac: 无效的标志: -J-Duser.language=en_us
> 用法: javac <options> <source files>
> -help 用于列出可能的选项
> at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:656)
> at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
> at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:105)
> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:577)
> ... 14 more
> [ERROR]
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira