Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 460384

Summary: Orion Maven build fails under Java 8
Product: [ECD] Orion Reporter: Mark Macdonald <mamacdon>
Component: RelengAssignee: Project Inbox <orion.releng-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: Michael_Rennie
Version: 7.0   
Target Milestone: 9.0   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Mark Macdonald CLA 2015-02-19 17:24:55 EST
Java 8+ use Nashorn as the JavaScript engine, not Rhino. The Orion client build currently contains Rhino-isms that fail under Nashorn.

1. Install Java 8 or higher.
2. Set the JAVA_HOME environment variable equal to {Java8_install_folder}\jre
3. Run 'mvn clean install'
4. You will get an error:

> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (generate-jsdocs-and-minify-javascript) on project org.eclipse.orion.client.parent: An Ant BuildException has occured: The following error occurred while executing this line:
> [ERROR] C:\Users\mamacdon\code\orion\client\releng\org.eclipse.orion.client.releng\builder\orion.jsdoc.xml:17: javax.script.ScriptException: TypeError: [Ljava.lang.Object;@855e93a4 has no such function "forEach" in <eval> at line number 51
> [ERROR] around Ant part ...<ant antfile="C:\Users\mamacdon\code\orion\client/releng/org.eclipse.orion.client.releng/builder/orion.jsdoc.xml">... @ 10:117 in C:\Users\mamacdon\code\orion\client\target\antrun\build-main.xml

It would be ideal if the build ran under both Rhino and Nashorn.
Comment 1 Michael Rennie CLA 2015-02-20 10:06:13 EST
I looked at this last week.

The simplest way to get it up and running on both is to get rid of the forEach calls an use normal for loops.

Theres also some discussion about forEach here:
http://stackoverflow.com/questions/27989239/foreach-migrating-from-rhino-to-nashorn

You can also try loading the rhino compatibility library like:

load("nashorn:mozilla_compat.js");

but that won't solve the problem of having a build that will run on all engines.
Comment 2 Mark Macdonald CLA 2015-02-20 14:58:10 EST
http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=df44abf

I didn't have to load the compatibility mode, I just check for Nashorn and then explicitly convert to a JS array. There was only 1 occurrence of this problem.