Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse: Is there an easy way to coordinate "Installed JREs" across a team?

I have an application that is composed of about 10 different Eclipse projects. Some projects must be built with Java 5, and others with Java 6. I have both of these JDKs registered with Eclipse's "Installed JREs" list as "jdk5" and "jdk6", respectively.

The appropriate JRE is on each project's build class path, which is reflected in the .classpath files. However, other members on my team are using different symbolic names for these JREs on their machines. Also, the .classpath files are checked into source control. As a result, people need to make local changes to their .classpath file in order to be able to build.

My instinct is to choose a naming convention for the installed JREs list and ask all the team members to stick with it. However, this just complicates the process of setting up a new developer. Really, I just want to say "build this project with Java 5" and "build that project with Java 6". I don't care where they are installed, or what their symbolic name is. Does Eclipse support this kind of configuration?

like image 517
Daniel Yankowsky Avatar asked Jun 04 '10 15:06

Daniel Yankowsky


2 Answers

Execution Environments are what you want (Preferences -> Java -> Installed JREs -> Execution Environments). You can change the classpath of your projects to use a JRE System Library that corresponds to a particular version of Java, like "J2SE-1.5" or "JavaSE-1.6". Then, Eclipse will categorize the installed JREs into those categories, and use the appropriate one when building your projects.

like image 84
paraquat Avatar answered Sep 23 '22 15:09

paraquat


Honestly, I use the maven (maven-compiler-plugin and profiles) for exactly this.

<plugin>
 <artifactId>maven-compiler-plugin</artifactId>
 <configuration>
  <source>1.5</source>
  <target>1.5</target>
 </configuration>
</plugin>

Using a system like maven (or ant, etc) helps us tremendously with classpath/environment/os-disparities problems across developers.

like image 45
Quotidian Avatar answered Sep 24 '22 15:09

Quotidian