Eclipse Kepler is unable to set the Java jdk 1.8 when maven project is updated

995 views Asked by At

Installed java version is 1.8, while selecting this version in pom.xml and updating the maven project,it automatically jumps from 1.8 to 1.4, due to which I am unable to have Lambda expression specific code.

I am using eclipse kepler.

Any idea what is happening here ?

2

There are 2 answers

0
Pankaj Sharma On BEST ANSWER

With the help of Hogler's comment above I am able to reswolve this issue

Just did this :

https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler

1
mez.pahlan On

Add something similar to this to your pom. You might have to tweak the plug in version.

<project> 
[...] 
    <build> 
    [...] 
        <plugins> 
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.3</version>
                <configuration> 
                    <source>1.8</source> 
                    <target>1.8</target>
                </configuration> 
            </plugin>
         </plugins> 
         [...] 
     </build>
 [...] 
</project>

Apologies I'm on mobile and the editor sucks for code formatting.

Edit: As noted in the accepted answer you also need to enable Java 8 support in Kepler.