Bug #218
closedAndroid client build fails on Windows when proguard is enabled
0%
Description
When proguard is enabled building the Android client fails because the command line used to execute proguard is too long for Windows systems.
Shortened output:
[INFO] C:\Program Files\Java\jdk1.7.0_02\jre\bin\java [-Xmx512M, -jar, C:\Program Files (x86)\Android\android-sdk\tools\proguard\lib\proguard.jar, @proguard.cfg, -injars, 'C:\Users\Dirk\git\ecard-client\clients\android\target\classes', -injars, C:\Users\Dirk\.m2\repository\org\openecard\common\1.1.0-SNAPSHOT\common-1.1.0-SNAPSHOT.jar(!META-INF/maven/**,!META-INF/MANIFEST.MF), .......
[INFO] Die Befehlszeile ist zu lang.
Maximum length for command lines on Windows systems (XP and higher) is 8191 characters but the generated command line is about 500 characters longer.
Updated by Tobias Wich over 11 years ago
Is it possible to raise this ridiculously low limit?
Bash gives me a much higher and more useful limit.
$ getconf ARG_MAX 2097152
I guess it would be pretty hard to shorten the proguard command. When new modules are added it even grows bigger.
It is probably best to add a Quirks section to the INSTALL file and provide a Windows workaround to raise the command size.
Updated by Dirk Petrautzki over 11 years ago
I don't see a way to raise the limit. Microsoft gives Information and suggests solutions under http://support.microsoft.com/kb/830473, but i think none of the solutions are usable here.
Updated by Tobias Wich over 11 years ago
The Plugin uses com.jayway.maven.plugins.android.CommandExecutor (the default implementation which is also in this file). The command is then executed via org.codehaus.plexus.util.cli.CommandLine which in fact uses cmd.exe to run the command.
I see a two options here:- Use proguard-maven-plugin (https://github.com/wvengen/proguard-maven-plugin) directly. This plugin uses ant (see https://github.com/wvengen/proguard-maven-plugin/blob/master/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java) to execute proguard and maybe the problem does not exist there.
- Supply a patch for the android-maven-plugin where the executor uses the Runtime.exec call from Java directly to run proguard instead of wrapping it into cmd.exe.
- Disable Proguard runs on Windows and add a note to the INSTALL file.
The first one is of course preferable, because it does not involve patching plugins.
Proguard is optional and only enabled in the release profile. So option 3 is ok for me, too.