java默认级别,在Eclipse中为Maven项目设置默认的Java合规性级别

The default compliance level for Maven is 1.5 and every time that I update a maven project in Eclipse it sets back the compliance level from 1.6 to 1.5 which is really annoying for me.

I know that I can set the target to 1.6 in the POM file but the problem is that I cannot set this in the parent POM and expect the children to inherit it. So I have to do it for every single Maven module. How can I set it in my Maven project or in the whole eclipse once for a "lifetime" without modifying every single Maven module!?

解决方案

I know that I can set the target to 1.6 in pom file but the problem is that I cannot set this in the parent pom and expect the children to inherit it.

Setting the and version in the parent pom does work.

For example, in my parent pom, I have:

org.apache.maven.plugins

maven-compiler-plugin

2.3.2

1.6

1.6

UTF-8

If you are having problems, you might want to check that:

the child specifies the correct version of the parent;

the parent pom specifies both source and target values;

you have run mvn install on the parent; and

mvn help:effective-pom on the child project shows the expected source/target values.

After modifying the poms, you may need to select both projects and use Maven->Update Project.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值