maven java version code example

Example 1: properties java 8 maven in pom xml

<properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
</properties>

Example 2: how to change maven java version in po,

<project>
...
 <properties>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
  </properties>
...
</project>

Example 3: know the version of maven

mvn --version

Example 4: how to change java version in pom.xml

<properties>    <maven.compiler.target>1.8</maven.compiler.target>    <maven.compiler.source>1.8</maven.compiler.source></properties>