将 Maven Java 编译器调试设置为 false 不会删除行号表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4220083/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Setting Maven Java compiler debug to false does not remove line number table?
提问by HDave
Perhaps this is my lack of understanding, but I would have assumed that doing this in a Maven Java project would disable all debug info from going into the Class file:
也许这是我缺乏理解,但我会假设在 Maven Java 项目中执行此操作会禁用所有调试信息进入 Class 文件:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<debug>false</debug>
</configuration>
</plugin>
However, I just tested it and while the local variable table is gone, and the source file reference is gone, the line number table is still present. I did a javap -l MyClass
and still got things like:
但是,我只是对其进行了测试,虽然局部变量表消失了,源文件引用也消失了,但行号表仍然存在。我做了一个javap -l MyClass
,仍然得到这样的东西:
protected com.mycorp.myapp.randomMethod();
LineNumberTable:
line 197: 0
line 68: 4
line 69: 9
line 70: 14
line 198: 19
Clearly, the stuff is still in there....I think.
显然,这些东西还在那里……我想。
回答by Pascal Thivent
This looks like MCOMPILER-114. Using the following seems to work with the version 2.3.2 of the plugin:
这看起来像MCOMPILER-114。使用以下内容似乎适用于插件的 2.3.2 版:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<debug>true</debug>
<debuglevel>none</debuglevel>
</configuration>
</plugin>
(yeah, I know, that's not what the documentation is saying, but well, it works)
(是的,我知道,这不是文档所说的,但是,它有效)