Generating debugging information with common Java build tools

There are many approaches for building large Java™ applications. Each of the common build tools including Apache Ant, Maven, and Gradle have different ways that debug flags must be specified for debug information to be included.

Apache Ant javac task

In the build.xml file, ensure that any instances of the javac task specify the debug options as in the following example:

<javac debug="true" debuglevel="source,lines,vars" <other attributes> >

Where <other attributes> refers to other site-specific or project-specific javac task compilation attributes. Refer to the Ant documentation for more information about the javac Ant task.

Maven maven-compiler-plugin

Maven is capable of compiling Java class files without specific instructions. However, to ensure that debug information is included, add a specific entry for maven-compiler-plugin. Ensure that the debug option appears in the configuration section for the plug-in.


Refer to the Maven documentation for more information about maven-compiler-plugin usage.


In the Gradle build file, ensure that the following properties are specified:

compileJava.options.debugOptions.debugLevel = "source,lines,vars"
compileTestJava.options.debugOptions.debugLevel = "source,lines,vars"