What causes imported Maven project in Eclipse to use Java 1.5 instead of Java 1.6 by default and how can I ensure it doesn't?

前端 未结 13 2099
情深已故
情深已故 2020-11-27 09:51

I imported a Maven project and it used Java 1.5 even though I have 1.6 configured as my Eclipse default Preferences->Java->Installed JREs.

When I

相关标签:
13条回答
  • 2020-11-27 10:21

    One more possible reason if you are using Tycho and Maven to build bundles, that you have wrong execution environment (Bundle-RequiredExecutionEnvironment) in the manifest file (manifest.mf) defined. For example:

    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-Name: Engine Plug-in
    Bundle-SymbolicName: com.foo.bar
    Bundle-Version: 4.6.5.qualifier
    Bundle-Activator: com.foo.bar.Activator
    Bundle-Vendor: Foobar Technologies Ltd.
    Require-Bundle: org.eclipse.core.runtime,
     org.jdom;bundle-version="1.0.0",
     org.apache.commons.codec;bundle-version="1.3.0",
     bcprov-ext;bundle-version="1.47.0"
    Bundle-RequiredExecutionEnvironment: JavaSE-1.5
    Export-Package: ...
    ...
    Import-Package: ...
    ...
    

    In my case everything else was ok. The compiler plugins (normal maven and tycho as well) were set correctly, still m2 generated old compliance level because of the manifest. I thought I share the experience.

    0 讨论(0)
提交回复
热议问题