Affects Version/s: 7.0.1 CE GA2
Fix Version/s: None
Component/s: App Management
To test the quality of an LPKG a reference, fictitious environment is used, instead of the running one. While this makes the validation predictable and reproducible, keeping this environment aligned with current specs can be troublesome.
In fact, in Liferay 7.0 (and currently on master too) the environment is assumed to use Java EE 1.7 and tests for compatibility for that JRE, but:
- Liferay 7 officially targets a Java 8 runtime (please refer to "Target the Appropriate Java JRE" paragraph in this documentation page);
- Liferay IDE requires Java 8;
- Liferay Workspaces built with Blade create modules with Java 8 by default.
The faulty implementation is in DefaultIndexValidator in the portal-target-platform-indexer bundle, where EE.JavaSE_1_7 is set as resourceBuilder.addEE(...).
The problem is that this issue prevents bundles to be submitted as-is to the Marketplace, where an automatic conversion to an LPKG is done.
Also there's no way (clean) to use Java 8 features in a bundle submitted to the Marketplace.
Change the osgi.ee version requirements in your bnd.bnd file. This fakes a lower dependency while your code and compiled bytecode can use and depend upon Java 1.8.
This is a dirty trick and I wont explain it any further.
The actual solution is to downgrade to Java 1.7. To do so add the following line to your build.gradle file:
- set the right osgi.ee in the final bundle META-INF/MANIFEST.MF;
- correctly compile your source to 1.7 bytecode;
- force you to use only 1.7 compatible features (no arrows ladies and gents).
Stacktrace for some SEO. Let's bring here who catches this issue.