只是一个简单的问题。对于 ANT 构建,如果我完全不使用 debuglevel
参数,它会使用所有调试信息进行编译吗?或者在 javac 任务中包含 debuglevel="lines,vars,source"
会更好吗?我想启用最高级别的调试。这是一个片段:
<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
属性设置为 true
,就可以不使用 debuglevel
属性。
来自javac Ant task
文档:
调试
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.
调试级别
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
标志而不附加任何内容等同于指定源、行和变量。
https://stackoverflow.com/questions/11891194/