java - 为 Apache ANT 启用 javac 调试

只是一个简单的问题。对于 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/

相关文章:

.net - 构建后的 MsBuild 复制文件

javascript - 仅当 src 发生更改时才运行构建

android - Xamarin.Android 构建/部署非常缓慢。如何加快他们的速度?

visual-c++ - 在 Windows 8 上为 Visual Studio 2012 构建

c# - Visual Studio : How to properly build and spe

shell - 在 jenkins 中运行命令 shell

eclipse - "Order and Export"中的 "Java Build Path"选项

optimization - Jekyll 编译似乎太慢了

build - apktool 构建 apk 失败

rest - Sonatype Nexus REST Api 获取最新的构建版本