Details
-
Type:
Improvement
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 2.8
-
Fix Version/s: None
-
Labels:None
-
Environment:JDK 1.6 and 1.4.2, Maven 2.2.1
-
Number of attachments :
Description
I was migrating a software source code from handcoded Ant to Maven.
The project is a Java 1.4 WebApp.
In order to compile the application, I use the Java 1.4.2 compiler, configuring maven-compiler-plugin as needed, it works fine for Maven.
When I import the project into Eclipse after using eclipse:eclipse, the compiler level is good (1.4) but the runtime library use is the default JRE used in the Workspace : JRE 1.6.0, the bad is that it permit to produce 1.4 bytecode accessing classes and/or methods that appears in later release of the Java Runtime.
In order to compile/execute the project against the 1.4 JRE, I found the Execution Environment which let Eclipse choose the appropriate Runtime and voila! My project compiling against JRE 1.4 runtime (previously added in Eclipse preferences screens)
For the moment, I use the <classpathContainers> configuration to tune the maven-eclipse-plugin but I think that it should look against the compiler level (like it looks for code character encoding) to choose the appropriate Runtime Environment and by default the default installed JRE.
The generated classpath contains :
org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4
instead of :
org.eclipse.jdt.launching.JRE_CONTAINER
I can later submit a patch including unit test if you do not have time to investigate.