tesla / m2eclipse-tycho

25 stars 26 forks source link

Take “JRE System Library” selected by target platform #30

Open sewe opened 8 years ago

sewe commented 8 years ago

Hi,

I hope this is the correct issue tracker for m2eclipse-tycho as found at http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-tycho/0.9.0/N/LATEST/.

I have an eclipse-plugin project, whose Bundle-RequiredExecutionEnvironment is JavaSE-1.7. This project is supposed to build one of two eclipse-target-definition target platforms. One target platform (mars) has an execution environment of JavaSE-1.7 and the other (neon) has an execution environment of JavaSE-1.8. Also, the mars target platform contains a library that requires JavaSE-1.7, whereas the neon target platform contains a newer version of said library that requires JavaSE-1.8.

The problem occurs if I Import > Maven > Exisiting Maven Project my eclipse-plugin project with the neon target platform selected in its POM.

The Tycho m2e connector configures a project-specific compiler compliance level of 1.7 (good), but also a JavaSE-1.7 “JRE System Library” based on the project's Bundle-RequiredExecutionEnvironment (bad).

This is a problem because I now get compilation errors:

The type java.util.function.Supplier cannot be resolved. It is indirectly referenced from required .class files

The project’s code itself does not use any Java 8 feature, but the newer version of the library does. IMHO, the JRE System Library” selected should be taken from the target platform rather than the Bundle-RequiredExecutionEnvironment header. Or am I mistaken?

briandealwis commented 7 years ago

I hit this same problem but with pure PDE. The workaround is to open Preferences > Java > Installed JREs > Execution Environments and change the JavaSE-1.7 EE to use a JavaSE 8 JRE.

I don't think it's anything Tycho or m2e-tycho can fix.