Could you tell me if it is mandatory to provide details of the maven-compiler-plugin?
Not. But he will use Java 1.3 or something from the Stone Age to compile.
If so, why so, I understand what he is doing, but not sure why this is necessary?
The answer is no. But here is the reason. You do not want to compile using Java 1.3 into your new code. You need all the new features in Java 5. Do you? :) So you have to add these extra lines to your already cluttered POM.
Is there any other way to call javac in maven?
Not. But mvn compile or any other command will work, even if you do not have this block. But compilation will fail if there are any advanced things in the source code that are in Java 5 but not in the previous version.
Change 1
How does it compile to 1.3 when I have JDK 5?
Well, it is possible to install this in the Java compiler. See here the Java compiler options: http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javac.html
It says that you can install source et al in an older version.
source share