Maven Compiler Plugin
  1. Maven Compiler Plugin
  2. MCOMPILER-59

Compilation fails on warning messages from javac (Java 6)

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.1
    • Labels:
      None
    • Environment:
    • Number of attachments :
      2

      Description

      The attached project fails due to an inability to parse the following warning messages from the Java compiler (Java 6)

      [INFO] Compilation failure
      could not parse error message: /Users/tmeighen/compiler-warning/entity/target/classes/test/MyEntity.class: warning: Cannot find annotation method 'name()' in type 'javax.persistence.Table': class file for javax.persistence.Table not found
      /Users/tmeighen/compiler-warning/logic/src/main/java/test/Logic.java:7: warning: [deprecation] deprecateMe() in test.MyEntity has been deprecated
      entity.deprecateMe();
      ^

      could not parse error message: /Users/tmeighen/compiler-warning/entity/target/classes/test/MyEntity.class: warning: Cannot find annotation method 'name()' in type 'javax.persistence.Table': class file for javax.persistence.Table not found
      /Users/tmeighen/compiler-warning/logic/src/main/java/test/Logic.java:7: warning: [deprecation] deprecateMe() in test.MyEntity has been deprecated
      entity.deprecateMe();
      ^

      1. compiler-warning.tar.gz
        2 kB
        Tim Meighen
      2. warning.tar.gz
        0.8 kB
        Christian Bach

        Issue Links

          Activity

          Hide
          Christian Bach added a comment - - edited

          The project in the second attachment fails in similar fashion when built using Java 6 on Linux.

          The problem is rooted in the compiler-plugin's dependency on plexus-compiler-javac which, in its current version 1.5.3, is not capable of parsing Java 6 warning and/or error messages properly.

          see also here: http://jira.codehaus.org/browse/PLXCOMP-87

          Show
          Christian Bach added a comment - - edited The project in the second attachment fails in similar fashion when built using Java 6 on Linux. The problem is rooted in the compiler-plugin's dependency on plexus-compiler-javac which, in its current version 1.5.3, is not capable of parsing Java 6 warning and/or error messages properly. see also here: http://jira.codehaus.org/browse/PLXCOMP-87
          Hide
          Ben Tatham added a comment -

          I have the same problem on this warning:
          C:\work\.....java:176: warning: sun.misc.Cleaner is Sun proprietary API and may be removed in a future release

          sun.misc.Cleaner cleaner = (sun.misc.Cleaner) getCleanerMethod

          ^

          If I turn off verbose on the compiler-plugin, it passes the build. With verbose=true, the build gets a Compilation Failure.

          Show
          Ben Tatham added a comment - I have the same problem on this warning: C:\work\.....java:176: warning: sun.misc.Cleaner is Sun proprietary API and may be removed in a future release sun.misc.Cleaner cleaner = (sun.misc.Cleaner) getCleanerMethod ^ If I turn off verbose on the compiler-plugin, it passes the build. With verbose=true, the build gets a Compilation Failure.
          Hide
          John Casey added a comment -

          Applied patch for PLXCOMP-87 from Christian Bach, and all is well. Tested against the attached warning.tar.gz...

          Show
          John Casey added a comment - Applied patch for PLXCOMP-87 from Christian Bach, and all is well. Tested against the attached warning.tar.gz...
          Hide
          John Casey added a comment -

          Need to look into NPE caused by move to 1.6-SNAPSHOT for plexus compiler stuff, and also whether the fix for this NPE is actually going to fix the problem...some indications I'm getting right now say no.

          Show
          John Casey added a comment - Need to look into NPE caused by move to 1.6-SNAPSHOT for plexus compiler stuff, and also whether the fix for this NPE is actually going to fix the problem...some indications I'm getting right now say no.
          Hide
          John Casey added a comment -

          added some more defensive code to the call to log information about the sources being compiled...for instance, if JavacCompiler is constructed without an accompanying call to enableLogging(..) because of some incompatibility with the AbstractLogEnabled/LogEnabled class/interface (like if it were loaded from the wrong classloader for some reason), then it should make sure the logger is not null before using it.

          Also, I adjusted the version for plexus-utils back to 1.0.4, and marked the plexus-container-default version to scope == test, since maven will provide its own.

          Show
          John Casey added a comment - added some more defensive code to the call to log information about the sources being compiled...for instance, if JavacCompiler is constructed without an accompanying call to enableLogging(..) because of some incompatibility with the AbstractLogEnabled/LogEnabled class/interface (like if it were loaded from the wrong classloader for some reason), then it should make sure the logger is not null before using it. Also, I adjusted the version for plexus-utils back to 1.0.4, and marked the plexus-container-default version to scope == test, since maven will provide its own.
          Hide
          Mike Calmus added a comment -

          Should this be working now in Maven 2.1.0? I'm still getting fatal errors when I have verbose compilation turned on.

          Show
          Mike Calmus added a comment - Should this be working now in Maven 2.1.0? I'm still getting fatal errors when I have verbose compilation turned on.
          Hide
          Ricardo Borillo added a comment -

          Hi all,

          Any news on this?? I'm still getting the same errors on 2.1.0 too ... Any workaround??

          Thanks

          Show
          Ricardo Borillo added a comment - Hi all, Any news on this?? I'm still getting the same errors on 2.1.0 too ... Any workaround?? Thanks
          Hide
          Jean-Marc Borer added a comment -

          I confirm that the problem still exists with 2.1.0. Turning off the "verbose" mode for the external compiler solves the problem. That's the workaround (for me at least).

          Show
          Jean-Marc Borer added a comment - I confirm that the problem still exists with 2.1.0. Turning off the "verbose" mode for the external compiler solves the problem. That's the workaround (for me at least).
          Hide
          Jonathan Johnson added a comment -

          My build is now breaking too after adding the SwingSet2.jar to one of my maven modules. This happens under Windows and Linux.

          Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400)
          Java version: 1.6.0_12
          Java home: /usr/java/jdk1.6.0_12/jre
          Default locale: en_US, platform encoding: UTF-8
          OS name: "linux" version: "2.6.18-92.1.18.el5" arch: "i386" Family: "unix"

          [ERROR] BUILD FAILURE
          [INFO] ------------------------------------------------------------------------
          [INFO] Compilation failure

          could not parse error message: DemoModule.java(:DemoModule.java):214: warning: [deprecation] show() in java.awt.Window has been deprecated
          frame.show();
          ^

          could not parse error message: SwingSet2.java(:SwingSet2.java):748: warning: [deprecation] show() in java.awt.Window has been deprecated
          f.show();
          ^

          could not parse error message: SwingSet2.java(:SwingSet2.java):1316: warning: [deprecation] show() in java.awt.Dialog has been deprecated
          aboutBox.show();

          Show
          Jonathan Johnson added a comment - My build is now breaking too after adding the SwingSet2.jar to one of my maven modules. This happens under Windows and Linux. Apache Maven 2.1.0 (r755702; 2009-03-18 15:10:27-0400) Java version: 1.6.0_12 Java home: /usr/java/jdk1.6.0_12/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux" version: "2.6.18-92.1.18.el5" arch: "i386" Family: "unix" [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Compilation failure could not parse error message: DemoModule.java(:DemoModule.java):214: warning: [deprecation] show() in java.awt.Window has been deprecated frame.show(); ^ could not parse error message: SwingSet2.java(:SwingSet2.java):748: warning: [deprecation] show() in java.awt.Window has been deprecated f.show(); ^ could not parse error message: SwingSet2.java(:SwingSet2.java):1316: warning: [deprecation] show() in java.awt.Dialog has been deprecated aboutBox.show();

            People

            • Assignee:
              John Casey
              Reporter:
              Tim Meighen
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: