设置Maven Java编译器debug为false不删除行号表? [英] Setting Maven Java compiler debug to false does not remove line number table?
问题描述
也许这是我缺乏理解,但我会假设这样做在一个Maven Java项目将禁用所有调试信息进入类文件:
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< configuration>
< debug> false< / debug>
< / configuration>
< / plugin>
但是,我只是测试它,并且当局部变量表不见了,去了,行号表仍然存在。我做了一个 javap -l MyClass
,仍然有像:
protected com.mycorp.myapp.randomMethod();
LineNumberTable:
line 197:0
line 68:4
line 69:9
line 70:14
line 198:19
显然,这些东西还在里面....我想。
这看起来像是 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>
(是啊,我知道,这不是文档说的, / p>
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:
<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:
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.
This looks like MCOMPILER-114. Using the following seems to work with the version 2.3.2 of the plugin:
<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)
这篇关于设置Maven Java编译器debug为false不删除行号表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!