Mike Edwards wrote:
Folks,
I ran a full build against Tuscany 2.0 after doing svn update earlier
today - and then executed mvn -Peclipse against the result.
The generated .classpath files for the Eclipse projects all contained
this entry:
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
I didn't used to get these entries in previous builds - and they screw
my Eclipse system, which is universally using JDK 6.x.
Any idea why these entries are turning up - and more importantly, how to
get rid of them?
Yours, Mike.
Folks,
This is probably a bug in the maven-eclipse-plugin code in version 2.6.
When it scans the Eclipse workspace settings, it goes looking for the JRE that Eclipse is using, in
the class org.apache.maven.plugin.eclipse.reader.ReadWorkspaceLocations
In here there is a method readAvailableJREs, which looks at the JRE entries in the Eclipse workspace
configuration file org.eclipse.jdt.launching.prefs, which is in workspace directory
..\.metadata\.plugins\org.eclipse.core.runtime\.settings
My config file has this as the path of the JRE that I am running:
path\="C\:\\Program Files\\Java\\jre1.6.0_07"
Note that this *IS* a JRE, not a JDK.
The code in readAvailableJREs reads the settings file and extracts the path setting (as above) and
then attempts to confirm that the path is correct by doing this:
File rtJarFile = new File( new File( jrePath ), "jre/lib/rt.jar" );
....where "jrePath" is the value of the path entry quoted above.
Well, if the path entry IS a JRE, as in my case, the jrePath already points at the JRE directory and
the rt.jar is in /lib/rt.jar *NOT* in /jre/lib/rt.jar. In other words, the code in
readAvailableJREs is assuming that the preferences entry is to a *JDK* not to a JRE, where indeed
there is a /jre subdirectory containing the JRE.
However, Eclipse does *NOT* require that you use a JDK and is happy for the path to point purely to
a JRE, as in my case.
So this code is bogus and needs fixing.
Of course, I scratch my head as to why they do this test at all. If you find the entry for the JRE
in the Eclipse configuration, why don't you simply assume it is correct?? If it were wrong then
Eclipse would have a much bigger problem to deal with.
Yours, Mike.