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!?
Another way (if you do not have already compiler plugin defined) is to set just these properties in your pom file:
Details: https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html
Go to the project's pom.xml and insert below in between tags. Then the eclipse plugin (like m2eclipse) should rebuild the workspace.
Note: this is project-level as only the project's pom.xml is affected.
Setting the
<source>
and<target>
version in the parent pom does work.For example, in my parent pom, I have:
If you are having problems, you might want to check that:
source
andtarget
values;mvn install
on the parent; andmvn 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.
This worked for me..