Accepted answer
  1. right-click on your project
  2. click properties
  3. click the "java compiler" option on the left menu
  4. under jdk compliance section on the right, change it to "1.7"
  5. run a maven clean and then maven build.


i got an error in eclipse mars version as "build path specifies execution environment j2se-1.5. there are no jres installed in the workspace that are strictly compatible with this environment.

to resolve this issue, please do the following steps, "right click on project choose build path choose configure build path choose libraries tab select jre system library and click on edit button choose workspace default jre and finish

problem will be resolved.


when creating a maven project in eclipse, the build path is set to jdk 1.5 regardless of settings, which is probably a bug in new project or m2e.


i tested all the answers about this topic. and nothing worked here… but i found another solution.

go to pom -> overview and add these to your properties:

name: “” value: “1.8”


name: “maven.compiler.source” value: “1.8”

now do a maven update.


i was facing the same issue. in pom.xml i have specified maven compiler plugin to pick 1.7 as source and target. even then when i would import the git project in eclipse it would pick 1.5 as compile version for the project. to be noted that the eclipse has installed runtime set to jdk 1.8

i also checked that none of the .classpath .impl or .project file is checked in git repository.

solution that worked for me: i simply deleted .classpath files and did a 'maven-update project'. .classpath file was regenerated and it picked up 1.7 as compile version from pom file.


in order to update your project to the latest version of java available in your environment, follow these steps:

  1. open your pom.xml file
  2. switch your view to effective pom tab
  3. open find dialog (ctrl + f) to search for maven-compiler-plugin
  4. copy the the following lines


  1. click on pom.xml tab to open your project pom configuration
  2. inside your <build> ... </build> configuration section, paste the configuration copied and modify it as...


  1. save your configuration
  2. right click in your project click on [maven -> update project] and click on ok in the displayed update dialog box.



if you are getting following type of error

maven build error

then do the following steps-->>

  • go to windows. then select preferences, in which select java(on the left corner).
  • in java select installed jres and check your jre(if you have correctly installed jdk and defined environment variables correct then you will see the current version of the installed java here)as shown - installed jre

(i have java 8 installed) check the check box if it is not checked. click apply and close.

now press alt+enter to go into project properties,or go via right clicking on project and select properties.

in properties select java build path on left corner

select libraries

check libraries

and click edit(after selecting the jre system library...) in edit click and select workspace default jre. then click finish

in order and export check the jre system library.

then finally apply and close clean the project and then build it.

problem solved..cheers!!


i'm using juno 4.2 with latest spring, maven plugin and jdk1.6.0_25.

i faced same issue and here is my fix that make default after each eclipse restart:

  1. list item
  2. right-click on the maven project
  3. java build path
  4. libraries tab
  5. select current wrong jre item
  6. click edit
  7. select the last option (workspace default jre (jdk1.6.0_25)


for imported maven project and jdk 1.7 do the following:

  1. delete project from eclipse (keep files)
  2. delete .settings directory, .project and .classpath files inside your project directory.
  3. modify your pom.xml file, add following properties (make sure following settings are not overridden by explicit maven-compiler-plugin definition in your pom)

  4. import updated project into eclipse.


i know this is an old topic. i had the same problem. i tested all the answers about this topic. and nothing worked here... but i found another solution.

go to pom->overview and add these to you properties:

  • name: "" value: "1.7"


  • name: "maven.compiler.source" value: "1.7"

now do a maven update.


all of the answers above may work for the time being but whenever you run maven on the command line or maven → update project… the jdk will be reset, this was also the question as i understand it.

to fix this for good add the following code to your pom file. remember to do a maven → update project… afterwards or mvn clean compile at the command line.



Related Query

More Query from same tag