Uploaded image for project: 'Maven Compiler Plugin'
  1. Maven Compiler Plugin
  2. MCOMPILER-114

Setting the debug option to false still compiles the code with line numbers resulting in increased class file.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 2.1
    • None
    • None
    • Windows XP Professional Version 5.1.2600 Service Pack 3 Build 2600, Dell OptiPlex GX280, Total Physical Memory 4,096.00 MB


    Description

      Given the following example:

      Bar.java
      public class Main {
         public static void main(String[] args) {
            for (StackTraceElement stackTraceElement : Thread.currentThread().getStackTrace())
               System.out.println(stackTraceElement);
         }
      }
      

      and pom.xml

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
      
         <modelVersion>4.0.0</modelVersion>
         <groupId>com.greg</groupId>
         <artifactId>TestApp</artifactId>
         <version>1</version>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <configuration>
                     <debug>none</debug>
                     <source>1.5</source>
                     <target>1.5</target>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </project>
      

      after compiling and running we get:

      cmd
      {TestApp}\target\classes>dir Main.class
      05/02/2010  XX:XX               564 Main.class
      
      {TestApp}\target\classes>java -cp . Main
      java.lang.Thread.dumpThreads(Native Method)
      java.lang.Thread.getStackTrace(Thread.java:1383)
      Main.main(Main.java:3)
      

      NOTE !!!: the number of line (Main.java:3) has been shown

      However when you compile the same java code using the javac we get:

      cmd
      {TestApp}\src\main\java>javac -g:none -source 1.5 -target 1.5 Main.java
      
      {TestApp}\src\main\java>dir Main.class
      05/02/2010  XX:XX               477 Main.class
      
      {TestApp}\src\main\java>java -cp . Main
      java.lang.Thread.dumpThreads(Native Method)
      java.lang.Thread.getStackTrace(Thread.java:1383)
      Main.main(Unknown Source)

      NOTE !!!: the number of line has not been shown

      Please find the whole sample project in Eclipse that uses m2eclipse plugin, that is configured for using external maven 2.2.1

      Attachments

        1. TestApp.zip
          3 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              soloman Grzegorz Solecki
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: