When I compile with -Dmaven.compiler.debug=true I do get a reduction in size however compiled code is still 10-20% larger than that compiled by either ant with debug=false or javac with the '-g:none' option.
Here's a closer look at the same class extracted from jars created with maven and ant using debug-false:
$ javap -l -verbose -c org/concord/mw2d/ActionStateEvent
The maven-generated class had three constants not in the ant-generated class:
const #12 = Asciz LineNumberTable;
const #16 = Asciz SourceFile;
const #17 = Asciz ActionStateEvent.java;
In addition each method in the class had a LineNumberTable like this:
line 30: 0
line 31: 5
line 32: 10
line 33: 15
It seems the only way to get maven to compile without the debugging resources is to add 'g:none' as a compiler argument for javac ... and this doesn't work from the command line – it only works if it is in the configuration element for the maven-compiler-plugin in the pom like this:
If the compilerArgument to 'g:none' is not set in the pom I can't get any variation of the following command line arguments to compile without some debugging info.
with or without:
with or without any of the following:
But I'd like the default to include debugging resources and to be able to easily optionally package without the debug resources – the easiest way would be able to pass in a command line argument ...