Setting Maven Java compiler debug to false does not remove line number table?

折月煮酒 提交于 2019-12-22 01:27:51

问题


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.


回答1:


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)



来源:https://stackoverflow.com/questions/4220083/setting-maven-java-compiler-debug-to-false-does-not-remove-line-number-table

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!