How to set the JDK compile and target class version in maven pom file?

28 Views Asked by At

I have seen similar questions asked, but their answers are not suitable for my question.

I have JDK 11 installed on my system(JAVA_HOME etc.) and configured in the Eclipse Java compiler option as well.

Now in my pom file, I am setting like...

  <build>
    <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.12.1</version>
            <configuration>
                <source>11</source>
                <target>11</target>
            </configuration>
        </plugin>
     </plugins>
   </build>

Some other examples mention like.. Setting JDK source, target

Are these two things going to achieve the same thing ? If so, which one is a better method ?

0

There are 0 best solutions below