启用javac的调试Apache Ant的 [英] Enabling javac debugging for Apache ANT
问题描述
只是一个简单的问题。对于ANT构建,如果我离开的 DEBUGLEVEL
参数完全脱离它会与所有调试信息编译?还是会更好,包括在javac任务 DEBUGLEVEL =行,增值经销商,源
?我想启用调试可能的最高水平。这里有一个片断:
< javac的SRCDIR =$ {} dir.source
DESTDIR =$ {} dir.classes
德precation =$ {javac.de precation}
调试=$ {芦荟code.release.mode}
DEBUGLEVEL =行,增值经销商,源< - 我应该离开这一行呢? - >
优化=$ {} javac.optimize>
简短的回答:是的,你可以离开,只要你设置 DEBUGLEVEL
属性了调试
属性真正
。
从 的javac Ant任务
文档
调试
表示是否来源应调试信息进行编译;默认为关闭。如果设置为off,-g:没有人会为支持它的编译器在命令行上传递(为其他编译器,没有命令行参数将被使用)。如果设置为true,则DEBUGLEVEL属性的值决定了命令行参数。
块引用>DEBUGLEVEL
关键词列表附加到-g命令行开关。这将通过现代化的除外,经典所有的实现被忽略(版本> = 1.2)和jikes的。合法值为none或逗号分隔的以下关键字的列表:线,增值经销商和来源。 的如果没有指定DEBUGLEVEL,默认情况下,什么都不会被追加到-g。的如果调试未打开,此属性将被忽略。
块引用>因此,设置
调试
到真正
并省略DEBUGLEVEL
是一样的传递标志-g
不带附加选项。根据本<一href=\"http://docs.oracle.com/javase/6/docs/technotes/tools/windows/javac.html\"><$c$c>javac$c$c>文档,传递什么也没有了-g
标志追加等同于指定的来源,线条和增值经销商。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 includedebuglevel="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}">
解决方案Short answer: Yes, you may leave the
debuglevel
attribute out as long as you set thedebug
attribute totrue
.From the
javac Ant task
documentation:debug
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
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.
Therefore, setting
debug
totrue
and omittingdebugLevel
is the same as passing the flag-g
with no options appended. According to thejavac
documentation, passing the-g
flag with nothing appended is equivalent to specifying sources, lines, and vars.这篇关于启用javac的调试Apache Ant的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!