Can you please tell me is it mandatory to specify the maven-compiler-plugin details in my POM under:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
If yes why so, i understand what it does, but not sure why its required? Isnt there any other way to invoke the javac in maven?
Can you please tell me is it mandatory to specify the maven-compiler-plugin details?
No. But it will use Java 1.3 or something from stone age to compile.
If yes why so, i understand what it does, but not sure why its required?
The answer is 'No'. But here is the reason. You sure do not want to compile using Java 1.3 on your new code. You want all the new features in Java 5. Don't you? :) So, you have to add these extra lines in your already cluttered POM.
Isnt there any other way to invoke the javac in maven?
There isn't. But mvn compile
or any other command will work even if you do not have this block. But compilation will fail if your source code has any advance stuffs that is in Java 5, but not in previous version.
Edit 1
How does it compile to 1.3 when I have JDK 5?
Well, there is an option to set to do so in Java compiler. See Java compiler options here: http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javac.html
It says you can set source
et al to older version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With