升级maven编译插件,maven编译器插件2.0.2

Can you please tell me is it mandatory to specify the maven-compiler-plugin details in my POM under:

org.apache.maven.plugins

maven-compiler-plugin

1.5

1.5

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.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值