How to make Maven use Eclipse workspace default JRE?

I'm using Spring Tool Suite and m2e to convert some of our existing projects to Maven projects. The project in question uses jdk1.6.0_20 which is named [jdk1.6] in Eclipse. When I do Maven -> Update project, though, it replaces that jre with the standard [JavaSE-1.6]. While they seem to point to the same libraries, the change in name causes a bunch of exceptions like:

Access restriction: The type WindowsPopupMenuSeparatorUI is not accessible due to restriction on required library C:\Program Files\Java\jdk1.6.0_20\jre\lib\rt.jar

My pom.xml has this:

<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>

Is there any way to get Maven/m2e to use the default workspace JRE instead of replacing it with a specific one in the .classpath?

Answers


  1. Go into Configure Build Path on the project and go to the Libraries tab.
  2. Remove the JRE System Library
  3. Click on "Add Library..." and select "Workspace Default JRE"

That will give you the current JRE and not specify a specific JRE


Need Your Help

play form-helper not displaying inline

css playframework

I'm new to the play framework and am trying to add a form to the top of my page with a simple username and password field and a submit button. I'm using the play form helper, but it won't allow me to

MVP Flow question

winforms inversion-of-control mvp

I am implementing the MVP pattern with Windows Form and I have a question about the current implementation as I am trying to fit this into a more complex architecture.