Java 7 and maven compiler

Got to install Java 7.   Tried it out on some of our source code.  Worked fine till there was a compilation error.   I use maven and was stuck by this error.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
3.2:compile (default-compile) on project my-app: Compilation failure
[ERROR] \work\my-app\src\main\java\com\mycompany\app\[11,45] error: can
not find symbol
[ERROR] -> [Help 1]
I am ok with the error, but which symbol does it fail to find?   Tried the same thing with Java 6.

ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.
.2:compile (default-compile) on project my-app: Compilation failure
ERROR] \work\my-app\src\main\java\com\mycompany\app\[11,45] cannot find
ERROR] symbol  : variable Dummy
ERROR] location: class
ERROR] -> [Help 1]
 I can clearly see which variable is not found.  So what has changed?

Tried javac on the class.  Output with java 7.

D:\work\my-app\src\main\java\com\mycompany\app>javac error: cannot find symbol
        System.out.println( "Hello World!" + Dummy);
  symbol:   variable Dummy
  location: class App
1 error
 Output with java 6.

D:\work\my-app\src\main\java\com\mycompany\app>"C:\Program Files\Java\jdk1.6.0_2
5\bin\javac.exe" cannot find symbol
symbol  : variable Dummy
location: class
        System.out.println( "Hello World!" + Dummy);
1 error
We can see a couple of differences with Java 7 compiler compared to Java 6.

  • Location does not show complete package, just the class
  • Symbol and location now come after the line which has the error, instead of before.
  • An additional "error" word comes before the error message

Essentially there is a change in compiler output in case of errors, which I guess needs a corresponding maven compiler change.  Until this is done, it is going to hard work, going to the specified line in the erring class to discover which is the symbol which is not found.

Update 03 Aug 2011: Logged a jira issue for this


Popular posts from this blog

Opening a safe deposit locker in SBI

Opening a Kannada Word document

Switching to Tatasky make my pack