diff --git a/CHANGELOG.md b/CHANGELOG.md index b430eeb..31d2e55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## Unreleased +## [4.1.1] 2024-08-30 + +- Upgrade to njre v1.4.0 +- Fix issue when package called from ES Module by using njre installPath option + ## [4.1.0] 2024-08-20 - Upgrade to MegaLinter v8 diff --git a/lib/java-caller.js b/lib/java-caller.js index 40143c4..16e7197 100644 --- a/lib/java-caller.js +++ b/lib/java-caller.js @@ -274,11 +274,8 @@ class JavaCaller { // Install appropriate java version using njre const njre = require("njre"); - const njreOptions = { type: javaTypeToInstall }; - const prevRequireMainFilename = require.main.filename; // hack require.main.filename to njre installs java where we want - require.main.filename = packageJson; + const njreOptions = { type: javaTypeToInstall, installPath: packageJson }; const installDir = await njre.install(javaVersionToInstall, njreOptions); - require.main.filename = prevRequireMainFilename; // unhack require.main.filename console.log(`Installed Java ${javaTypeToInstall} ${javaVersionToInstall} in ${installDir}...`); // Call again this method: now matching java version will be found :) diff --git a/package-lock.json b/package-lock.json index 0e0d9e1..022e162 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "debug": "^4.3.4", "fs-extra": "^11.1.1", - "njre": "^1.2.1", + "njre": "^1.4.0", "semver": "^7.5.4" }, "devDependencies": { @@ -2696,9 +2696,10 @@ "dev": true }, "node_modules/njre": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/njre/-/njre-1.3.0.tgz", - "integrity": "sha512-sFxwcEhv5gEyfS9Oe/KpyuMhlIegtfvmxXD6DQ92nj2fralt79btKfRqeG6AVQEYo+qEZoAqMbdO9wjYH/zLOw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/njre/-/njre-1.4.0.tgz", + "integrity": "sha512-+4Ly9RX4BlIH4ri0Mz9nGdajCa79778omUXHTeAw7vSJCFbh5pz6lbrsNOokZJpR4+LHwHYLmMLxBMaQoZPl+A==", + "license": "MIT", "dependencies": { "command-exists-promise": "^2.0.2", "debug": "^4.3.4", @@ -5995,9 +5996,9 @@ "dev": true }, "njre": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/njre/-/njre-1.3.0.tgz", - "integrity": "sha512-sFxwcEhv5gEyfS9Oe/KpyuMhlIegtfvmxXD6DQ92nj2fralt79btKfRqeG6AVQEYo+qEZoAqMbdO9wjYH/zLOw==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/njre/-/njre-1.4.0.tgz", + "integrity": "sha512-+4Ly9RX4BlIH4ri0Mz9nGdajCa79778omUXHTeAw7vSJCFbh5pz6lbrsNOokZJpR4+LHwHYLmMLxBMaQoZPl+A==", "requires": { "command-exists-promise": "^2.0.2", "debug": "^4.3.4", diff --git a/package.json b/package.json index 4aa2da9..19adb79 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "dependencies": { "debug": "^4.3.4", "fs-extra": "^11.1.1", - "njre": "^1.2.1", + "njre": "^1.4.0", "semver": "^7.5.4" }, "devDependencies": {