0

When importing an existing Maven project into Eclipse, where is the JDK / JRE being driven from? For example, as per below, on import, its being set to J2SE 1.4 however I want it to be JDK 1.8. enter image description here

How can I set it in the Maven pom so that when other devs get the project, on import Eclipse will point to JDK 1.8 and not 1.4?

Carlos Jaime C. De Leon
  • 2,476
  • 2
  • 37
  • 53
  • Possible duplicate of [What causes a new Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?](https://stackoverflow.com/questions/3539139/what-causes-a-new-maven-project-in-eclipse-to-use-java-1-5-instead-of-java-1-6-b) – Line Sep 12 '17 at 13:48

1 Answers1

0

My suggestion is to specify the version of Java from the configuration of the maven-compiler-plugin plugin. Please check the following skeleton.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    ...
    <properties>
        ...
        <java.version>1.8</java.version>
        ...
    </properties>
    ...
    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                    <verbose>true</verbose>
                    <debug>${debug}</debug>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            ... 
        </plugins>
        ...
        <resources>
            ...
        </resources>
        ...
    </build>
    ...
</project>
sandromark78
  • 148
  • 1
  • 4