Substitute mozilla_compat.js with a newer alternative in your ant script to update your JavaScript Nashorn implementation

The deprecation of Nashorn by Oracle has posed a challenge for my Apache Ant build scripts, where I heavily rely on it.

Below is a brief example of my usage:

try{load("nashorn:mozilla_compat.js");}catch(e){;}
    importClass(java.io.File);
    var sourceName = project.getProperty("build.source.dir") + "/" +project.getProperty("teiFile") + ".xml";
    var targetName = project.getProperty("build.search.dir") + "/" + project.getProperty("teiFile") + ".xml";
    var sourceFile = new File("", sourceName);
    var targetFile = new File("", targetName);
    var uptodate = targetFile.exists() && sourceFile.lastModified() < targetFile.lastModified();
      var sourcePrefix = project.getProperty("teiFile");
      if(!uptodate & !sourcePrefix.startsWith("G")) {
         ......
       }
}

I have come across suggestions to use Rhino or GraalVM as alternatives, but both come with their own set of drawbacks. Any recommendations for an active and stable library would be greatly appreciated.

Thanks, Scott

Answer №1

Currently, GraalVM is up and running smoothly, boasting a Nashorn compatibility mode for stability. Ant scripts can be executed with GraalVM, as it comes equipped with a default JS engine. Alternatively, GraalVM's JavaScript dependencies can be incorporated to run on OpenJDK, although this may result in slower performance due to the untested nature of this combination. Still, it has been proven to work as an option.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Data is not being stored in Parse

I am currently facing a challenge while working with Parse for Javascript: When users sign up, along with their username and password, I also need to save their first and last names in Parse. However, at the moment, only the username and password are bein ...

Slider for jQuery or Ajax framework

Currently, I am in search of a gauge that contains multiple concentric circles, with each circle displaying values of different entities, similar to the image provided. Each individual needle indicates the value of its corresponding entity. I have come a ...

Attaching an event listener to elements with a specified Class name

Currently facing a challenge where I am trying to implement a function that captures click events on squares. The objective is to capture the click event on every button with the square class. import { Component, OnInit } from '@angular/core&apos ...

Exploring the world of handling GET and POST parameters in Node.js with

As someone who is new to Node/Express, I've noticed that GET parameters can be captured using the following syntax: app.get('/log/:name', api.logfunc); For POST requests, it can be done like this: app.post('/log', ... (with for ...

Changing jQuery to plain JavaScript in order to show a div element more effectively

I am attempting to toggle a checkbox to display a header or div that is currently hidden. @media screen and (max-width: 639.98px){ #menuPanel{ display: none !important; } } I am encountering an unresolved method error on ready in JQuery, ...

Issue with form validation in Bootstrap 5.2 JavaScript implementation

I'm having trouble with my client-side form validation not working properly before the server-side validation kicks in. I've implemented Bootstrap 5.2 and followed the documentation by adding needs-validation and novalidate to the form. Scenario ...

Executing PHP Code following a JavaScript Confirmation Box: Best Practices

How can I run the following code in PHP? var answer = window.confirm("Do you want to overwrite the file..."); Based on the user's selection of "OK" or "CANCEL"; If the user chooses "OK", I need to execute the following PHP code without using AJAX. ...

Applying a value to all JSON objects within an array using AngularJS and JavaScript

Tale: I've developed an array ($scope.mainArray) that will be displayed in a <table> with <tr> elements using ng-repeat as shown below: +---+ | 1 | +---+ | 2 | +---+ | 3 | +---+ Each object contains an array which is presented within & ...

What is the best way to transform a synchronous function call into an observable?

Is there a conventional method or developer in RxJS 6 library that can transform a function call into an observable, as shown below? const liftFun = fun => { try { return of(fun()) } catch (err) { return throwError(err) } ...

Objects within the Prototype in Javascript

While delving into the world of AngularJS, I stumbled upon an interesting revelation - when objects are placed in a prototype object, any instances inheriting from that prototype will alter the prototype's objects upon assignment. For example: funct ...

The subpage is not compatible with react-router 4

I've configured my router in the following way: <Switch> <PrivatePage key={index} {...opts} component={(props) => <Section {...props} pages={childRoutes} /> } /> <PrivatePage path='/accounts/:id' exact={t ...

Prevent access to the app on an Android device

In my application, I have successfully implemented a system that can detect if the current version is outdated and in need of an update. The detection process is working flawlessly. However, my issue lies in how to prevent the application from being used ...

An unexpected { token error was encountered by Jest while running a React application

I am facing a persistent issue that I just can't seem to resolve. Despite trying numerous solutions found online, nothing seems to fix it. Below are the configurations: package.json { "scripts": { "test": "jest --no-cache", ...

Designing a book-style layout using jQuery

I am currently working on a web application that needs to display its data in a book-like format. The structure of the data is as follows: Menu{ String menuName; List<String> subMenu; } To achieve this, I utilized jQuery to dynamically generate ...

Configure markers on Google Maps

I've been attempting to integrate my markers into Google Maps, but I'm stuck on how to use the following: map.fitBounds(latlngbounds); Any ideas on how I can implement this easily? Below is the code I have so far: <script type="text/javas ...

Using Ajax to Receive Data in a Separate JavaScript Function

I have a scenario where I am making an AJAX call in one function and attempting to capture the result in another function. Let me explain this in detail below: function myMain(){ var test = myWPackage(); alert(test); } function myWPackage(){ ...

Unable to set custom claims using Firebase Auth's setCustomClaims() method

I am encountering an issue with setting custom claims for Firebase Authentication service's token. I am using a Cloud function to establish the custom claims for Hasura. The cloud function is triggered upon the creation of a new user to set the custom ...

How come props do not get updated along with state changes?

I've encountered an issue where the state of a component being passed into another component as a prop is not updating correspondingly. Various attempts have been made to resolve this, including placing it in the return function and updating the "low ...

Issue with TinyMCE Editor: Inoperative

<script type="text/javascript" src="<your installation path>/tinymce/tinymce.min.js"></script> <script type="text/javascript"> tinymce.init({ selector: "textarea", theme: "modern", plugins: [ "advlist autolink li ...

What is the best way to include bootstrap using webpack?

I am currently building a webapp using Typescript and webpack. I have been able to successfully import some modules by including them in my webpack.config.js file as shown below. However, no matter how many times I attempt it, I cannot seem to import the b ...