Search code examples
javamaven-2

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


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.


Solution

  • 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)