Skip to content

Commit

Permalink
- Upgrade to njre v1.4.0 (#95)
Browse files Browse the repository at this point in the history
- Fix issue when package called from ES Module by using njre installPath option
  • Loading branch information
nvuillam authored Aug 29, 2024
1 parent 28b80f5 commit 300ca41
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions lib/java-caller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 :)
Expand Down
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 300ca41

Please sign in to comment.