为 Apache ANT 启用 javac 调试 [英] Enabling javac debugging for Apache ANT
问题描述
只是一个简单的问题.对于 ANT 构建,如果我完全保留 debuglevel
参数,它是否会使用所有调试信息进行编译?或者在 javac 任务中包含 debuglevel="lines,vars,source"
会更好吗?我想启用最高级别的调试.这是一个片段:
Just a simple question. For ANT builds, if I leave the the debuglevel
parameter completely out will it compile with ALL debugging information? Or would it be better to include debuglevel="lines,vars,source"
in javac task? I want to enable the maximum level of debugging possible. Here's a snippet:
<javac srcdir="${dir.source}"
destdir="${dir.classes}"
deprecation="${javac.deprecation}"
debug="${veracode.release.mode}"
debuglevel="lines,vars,source" <-- should I leave this line out? -->
optimize="${javac.optimize}">
推荐答案
简短回答:是的,只要您设置了 debug
,您就可以不使用 debuglevel
属性属性为 true
.
Short answer: Yes, you may leave the debuglevel
attribute out as long as you set the debug
attribute to true
.
来自 javac Ant task
文档:
From the javac Ant task
documentation:
调试
指示是否应使用调试信息编译源代码;默认为关闭.如果设置为 off, -g:none 将在支持它的编译器的命令行上传递(对于其他编译器,将不使用命令行参数).如果设置为 true,则 debuglevel 属性的值决定命令行参数.
Indicates whether source should be compiled with debug information; defaults to off. If set to off, -g:none will be passed on the command line for compilers that support it (for other compilers, no command line argument will be used). If set to true, the value of the debuglevel attribute determines the command line argument.
debugLevel
要附加到 -g 命令行开关的关键字列表.这将被除现代、经典(版本 >= 1.2)和 jikes 之外的所有实现忽略.合法值为 none 或以下关键字的逗号分隔列表:lines、vars 和 source.如果未指定 debuglevel,默认情况下,-g 不会附加任何内容.如果未打开 debug,则该属性将被忽略.
Keyword list to be appended to the -g command-line switch. This will be ignored by all implementations except modern, classic(ver >= 1.2) and jikes. Legal values are none or a comma-separated list of the following keywords: lines, vars, and source. If debuglevel is not specified, by default, nothing will be appended to -g. If debug is not turned on, this attribute will be ignored.
因此,将 debug
设置为 true
并省略 debugLevel
与传递标志 -g
与没有附加选项.根据javac
文档,传递 -g
标志而不附加任何内容等同于指定源、行和变量.
Therefore, setting debug
to true
and omitting debugLevel
is the same as passing the flag -g
with no options appended. According to the javac
documentation, passing the -g
flag with nothing appended is equivalent to specifying sources, lines, and vars.
这篇关于为 Apache ANT 启用 javac 调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!