Wednesday, July 1, 2015

Specifying javac debug flags in Maven

If you have the disgrace of using Maven in your project, you might be also unhappy about the fact that javac compilation is done using the standard debug flags

http://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html

-g:{keyword list}

source Source file debugging information
lines Line number debugging information
vars Local variable debugging information


so passing -g:{source,lines,vars} activates the MAXIMUM debug info in the compiled classes.

Hew to pass these flags using maven is explained here http://stackoverflow.com/questions/14920921/how-to-pass-j-options-to-javac-through-maven , i.e. just add to your pom.xml this splendid XML and try not to puke for XML indigestion:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <compilerArgument>-J-g:{source,lines,vars}</compilerArgument>
    </configuration>
</plugin>


No comments: