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

PgSQL turning day-of-year back into date

postgresql date

I am trying to determine how to turn a day-of-year back into a date in PgSQL. When I do this

What does -p mean when launching vim in bash?

bash vim terminal

I'm looking for a simple explanation. I've already scoured the internet but I found nothing satisfactory. I know I use it to open multiple files in Vim in tabs, so I'm assuming it pipes everything ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.