Compare commits

..

8 Commits

Author SHA1 Message Date
dependabot[bot]
347eb3cb2d Bump js-yaml and xmlbuilder2
Bumps [js-yaml](https://github.com/nodeca/js-yaml) to 4.1.1 and updates ancestor dependencies [js-yaml](https://github.com/nodeca/js-yaml) and [xmlbuilder2](https://github.com/oozcitak/xmlbuilder2). These dependencies need to be updated together.


Updates `js-yaml` from 4.1.0 to 4.1.1
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

Updates `js-yaml` from 3.14.1 to 3.14.2
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.1.0...4.1.1)

Updates `xmlbuilder2` from 2.4.1 to 4.0.0
- [Changelog](https://github.com/oozcitak/xmlbuilder2/blob/master/CHANGELOG.md)
- [Commits](https://github.com/oozcitak/xmlbuilder2/compare/v2.4.1...v4.0.0)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: indirect
- dependency-name: js-yaml
  dependency-version: 3.14.2
  dependency-type: indirect
- dependency-name: xmlbuilder2
  dependency-version: 4.0.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-17 16:56:18 +00:00
Christoph Langer
66b945764b Update SapMachine URLs (#955) 2025-11-17 10:33:06 -06:00
priya-kinthali
6ba5449b7d Enhance error logging for network failures to include endpoint/IP details, add retry mechanism and update workflows to use macos-15-intel (#946)
* enhance error logging and implement retry

* Replace macos-13 with macos-15-intel

* refactored code based on Copilot suggestions
2025-11-13 13:34:50 -06:00
the-mod
de5a937a1d adds microsoft openjdk25 builds (#927)
* adds microsoft java 25 build

adds microsoft java 25 build

* tests and formatting

* Add Microsoft distribution for version 25 on multiple OS
2025-10-27 15:17:49 -05:00
aparnajyothi-y
ead9eaa3cf Update Regex to Support All ASDF Versions for the supported distributions in tool-versions File (#767)
* Regex update to fix #719

* Check failures fix

* npm run format, npm run format-check & npm run build

* Regex update

* regex update

* fixed check failures

* updated regex

* regex update for all the versions

* regex and docmentation update

* Regex update

* format and doc update

* doc format update

* npm audit fix

* resolve conflicts

* resolve conflicts

* resolve conflicts

* doc update

* Java version upgrade
2025-09-16 13:23:22 -05:00
Chiranjib Swain
8c57fa3627 Clarify JAVA_HOME and PATH setup in README (#841)
* Update README to clarify JAVA_HOME and PATH setup

* Clarify instructions for setting up multiple JDKs in README
2025-09-16 13:19:02 -05:00
dependabot[bot]
a7ab372554 Bump prettier from 2.8.8 to 3.6.2 (#873)
* Bump prettier from 2.8.8 to 3.6.2

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.6.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.6.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-version: 3.6.2
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* doc update and check failure fix

* npm run format-check

* doc format update

* doc update

* doc update

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aparna Jyothi <aparnajyothi-y@github.com>
2025-09-09 10:02:46 -05:00
lmvysakh
d0351b4837 Update documentation to use checkout and Java v5 (#903)
Co-authored-by: lmvysakh <lmvysakh@github.com>
2025-09-03 14:04:05 -05:00
19 changed files with 594 additions and 360 deletions

View File

@@ -21,7 +21,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
@@ -46,7 +46,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
needs: gradle-save needs: gradle-save
steps: steps:
- name: Checkout - name: Checkout
@@ -70,7 +70,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
@@ -93,7 +93,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
needs: maven-save needs: maven-save
steps: steps:
- name: Checkout - name: Checkout
@@ -121,7 +121,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-22.04] os: [macos-15-intel, windows-latest, ubuntu-22.04]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v5
@@ -133,7 +133,7 @@ jobs:
java-version: '11' java-version: '11'
cache: sbt cache: sbt
- name: Setup SBT - name: Setup SBT
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
echo ""Installing SBT..."" echo ""Installing SBT...""
brew install sbt brew install sbt
@@ -141,7 +141,7 @@ jobs:
run: sbt update run: sbt update
- name: Check files to cache on macos-latest - name: Check files to cache on macos-latest
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
@@ -170,7 +170,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-22.04] os: [macos-15-intel, windows-latest, ubuntu-22.04]
needs: sbt-save needs: sbt-save
steps: steps:
- name: Checkout - name: Checkout
@@ -184,7 +184,7 @@ jobs:
cache: sbt cache: sbt
- name: Confirm that ~/Library/Caches/Coursier directory has been made - name: Confirm that ~/Library/Caches/Coursier directory has been made
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"

View File

@@ -20,7 +20,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
distribution: [ distribution: [
'temurin', 'temurin',
'adopt', 'adopt',
@@ -39,10 +39,19 @@ jobs:
- distribution: microsoft - distribution: microsoft
version: 8 version: 8
- distribution: dragonwell - distribution: dragonwell
os: macos-13 os: macos-15-intel
include: include:
- distribution: microsoft
os: windows-latest
version: 25
- distribution: microsoft
os: ubuntu-latest
version: 25
- distribution: microsoft
os: macos-latest
version: 25
- distribution: oracle - distribution: oracle
os: macos-13 os: macos-15-intel
version: 17 version: 17
- distribution: oracle - distribution: oracle
os: windows-latest os: windows-latest
@@ -220,7 +229,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
version: ['17-ea', '15.0.0-ea.14'] version: ['17-ea', '15.0.0-ea.14']
steps: steps:
- name: Checkout - name: Checkout
@@ -286,7 +295,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
distribution: distribution:
['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains'] ['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains']
java-package: ['jre'] java-package: ['jre']

View File

@@ -18,11 +18,20 @@ The `setup-java` action provides the following functionality for GitHub Actions
This action allows you to work with Java and Scala projects. This action allows you to work with Java and Scala projects.
## Breaking changes in V5
- Upgraded action from node20 to node24
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release [Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
For more details, see the full release notes on the [releases page](https://github.com/actions/setup-java/releases/tag/v5.0.0)
## V2 vs V1 ## V2 vs V1
- V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK. - V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK.
- V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2. - V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2.
For information about the latest releases, recent updates, and newly supported distributions, please refer to the `setup-java` [Releases](https://github.com/actions/setup-java/releases).
## Usage ## Usage
- `java-version`: The Java version that is going to be set up. Takes a whole or [semver](#supported-version-syntax) Java version. If not specified, the action will expect `java-version-file` input to be specified. - `java-version`: The Java version that is going to be set up. Takes a whole or [semver](#supported-version-syntax) Java version. If not specified, the action will expect `java-version-file` input to be specified.
@@ -69,8 +78,8 @@ This action allows you to work with Java and Scala projects.
#### Eclipse Temurin #### Eclipse Temurin
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' # See 'Supported distributions' for available options distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21' java-version: '21'
@@ -80,8 +89,8 @@ steps:
#### Azul Zulu OpenJDK #### Azul Zulu OpenJDK
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'zulu' # See 'Supported distributions' for available options distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '21' java-version: '21'
@@ -136,8 +145,8 @@ The cache input is optional, and caching is turned off by default.
#### Caching gradle dependencies #### Caching gradle dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -151,8 +160,8 @@ steps:
#### Caching maven dependencies #### Caching maven dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -165,8 +174,8 @@ steps:
#### Caching sbt dependencies #### Caching sbt dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -185,8 +194,8 @@ Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a
env: env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5' SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -205,8 +214,8 @@ For Java distributions that are not cached on Hosted images, `check-latest` alwa
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -224,9 +233,9 @@ jobs:
java: [ '8', '11', '17', '21' ] java: [ '8', '11', '17', '21' ]
name: Java ${{ matrix.Java }} sample name: Java ${{ matrix.Java }} sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@@ -235,11 +244,11 @@ jobs:
### Install multiple JDKs ### Install multiple JDKs
All versions are added to the PATH. The last version will be used and available globally. Other Java versions can be accessed through env variables with such specification as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'. All configured Java versions are added to the PATH. The last one added to the PATH (i.e., the last JDK set up by this action) will be used as the default and available globally. Other Java versions can be accessed through environment variables such as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'. To use a specific Java version, set the JAVA_HOME environment variable accordingly and prepend its bin directory to the PATH to ensure it takes priority during execution.
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |

View File

@@ -1,4 +1,47 @@
[ [
{
"version": "25.0.0",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-25.0.0-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-x64.zip"
},
{
"filename": "microsoft-jdk-25.0.0-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-windows-aarch64.zip",
"arch": "aarch64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-aarch64.zip"
}
]
},
{ {
"version": "21.0.0", "version": "21.0.0",
"stable": true, "stable": true,

View File

@@ -150,9 +150,8 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
version await distribution['findPackageForDownload'](version);
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
}); });
@@ -222,9 +221,8 @@ describe('getAvailableVersions', () => {
const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`; const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`;
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
'17' await distribution['findPackageForDownload']('17');
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

View File

@@ -206,9 +206,8 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
jdkVersion await distribution['findPackageForDownload'](jdkVersion);
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

View File

@@ -76,9 +76,8 @@ describe('findPackageForDownload', () => {
checkLatest: false checkLatest: false
}); });
distribution['getAvailableVersions'] = async () => manifestData as any; distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion = await distribution['findPackageForDownload']( const resolvedVersion =
input await distribution['findPackageForDownload'](input);
);
const url = resolvedVersion.url; const url = resolvedVersion.url;
const options = {method: 'HEAD'}; const options = {method: 'HEAD'};

View File

@@ -29,6 +29,11 @@ describe('findPackageForDownload', () => {
}); });
it.each([ it.each([
[
'25.x',
'25.0.0',
'https://aka.ms/download-jdk/microsoft-jdk-25.0.0-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
],
[ [
'21.x', '21.x',
'21.0.0', '21.0.0',

View File

@@ -61,9 +61,8 @@ describe('getAvailableVersions', () => {
mockPlatform(distribution, 'linux'); mockPlatform(distribution, 'linux');
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
version await distribution['findPackageForDownload'](version);
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe( expect(availableVersion.url).toBe(
'https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.10/sapmachine-jdk-17.0.10_linux-x64_bin.tar.gz' 'https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.10/sapmachine-jdk-17.0.10_linux-x64_bin.tar.gz'
@@ -230,9 +229,8 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
normalizedVersion await distribution['findPackageForDownload'](normalizedVersion);
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

View File

@@ -94704,7 +94704,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
const versionFileName = getFileName(versionFile); const versionFileName = getFileName(versionFile);
if (versionFileName == '.tool-versions') { if (versionFileName == '.tool-versions') {
javaVersionRegExp = javaVersionRegExp =
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(-ea(\.\d+)?)?)$/m; /^java\s+(?:\S*-)?(?<version>\d+(?:\.\d+)*([+_.-](?:openj9[-._]?\d[\w.-]*|java\d+|jre[-_\w]*|OpenJDK\d+[\w_.-]*|[a-z0-9]+))*)/im;
} }
else { else {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;

125
dist/setup/index.js vendored
View File

@@ -129856,6 +129856,7 @@ class JavaBase {
this.checkLatest = installerOptions.checkLatest; this.checkLatest = installerOptions.checkLatest;
} }
setupJava() { setupJava() {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let foundJava = this.findInToolcache(); let foundJava = this.findInToolcache();
if (foundJava && !this.checkLatest) { if (foundJava && !this.checkLatest) {
@@ -129863,40 +129864,106 @@ class JavaBase {
} }
else { else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
try { const MAX_RETRIES = 4;
const javaRelease = yield this.findPackageForDownload(this.version); const RETRY_DELAY_MS = 2000;
core.info(`Resolved latest version as ${javaRelease.version}`); const retryableCodes = [
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) { 'ETIMEDOUT',
core.info(`Resolved Java ${foundJava.version} from tool-cache`); 'ECONNRESET',
} 'ENOTFOUND',
else { 'ECONNREFUSED'
core.info('Trying to download...'); ];
foundJava = yield this.downloadTool(javaRelease); let retries = MAX_RETRIES;
core.info(`Java ${foundJava.version} was downloaded`); while (retries > 0) {
} try {
} // Clear console timers before each attempt to prevent conflicts
catch (error) { if (retries < MAX_RETRIES && core.isDebug()) {
if (error instanceof tc.HTTPError) { const consoleAny = console;
if (error.httpStatusCode === 403) { (_b = (_a = consoleAny._times) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
core.error('HTTP 403: Permission denied or access restricted.');
} }
else if (error.httpStatusCode === 429) { const javaRelease = yield this.findPackageForDownload(this.version);
core.warning('HTTP 429: Rate limit exceeded. Please retry later.'); core.info(`Resolved latest version as ${javaRelease.version}`);
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} }
else { else {
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`); core.info('Trying to download...');
foundJava = yield this.downloadTool(javaRelease);
core.info(`Java ${foundJava.version} was downloaded`);
} }
break;
} }
else { catch (error) {
const message = error instanceof Error ? error.message : JSON.stringify(error); retries--;
core.error(`Java setup failed due to network issue or timeout: ${message}`); // Check if error is retryable (including aggregate errors)
const isRetryable = (error instanceof tc.HTTPError &&
error.httpStatusCode &&
[429, 502, 503, 504].includes(error.httpStatusCode)) ||
retryableCodes.includes(error === null || error === void 0 ? void 0 : error.code) ||
((error === null || error === void 0 ? void 0 : error.errors) &&
Array.isArray(error.errors) &&
error.errors.some((err) => retryableCodes.includes(err === null || err === void 0 ? void 0 : err.code)));
if (retries > 0 && isRetryable) {
core.debug(`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`);
yield new Promise(r => setTimeout(r, RETRY_DELAY_MS));
continue;
}
if (error instanceof tc.HTTPError) {
if (error.httpStatusCode === 403) {
core.error('HTTP 403: Permission denied or access restricted.');
}
else if (error.httpStatusCode === 429) {
core.warning('HTTP 429: Rate limit exceeded. Please retry later.');
}
else {
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
}
}
else if (error && error.errors && Array.isArray(error.errors)) {
core.error(`Java setup failed due to network or configuration error(s)`);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
for (const err of error.errors) {
const endpoint = (err === null || err === void 0 ? void 0 : err.address) || (err === null || err === void 0 ? void 0 : err.hostname) || '';
const port = (err === null || err === void 0 ? void 0 : err.port) ? `:${err.port}` : '';
const message = (err === null || err === void 0 ? void 0 : err.message) || 'Aggregate error';
const endpointInfo = !message.includes(endpoint)
? ` ${endpoint}${port}`
: '';
const localInfo = err.localAddress && err.localPort
? ` - Local (${err.localAddress}:${err.localPort})`
: '';
const logMessage = `${message}${endpointInfo}${localInfo}`;
core.error(logMessage);
core.debug(`${err.stack || err.message}`);
Object.entries(err).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
}
else {
const message = error instanceof Error ? error.message : JSON.stringify(error);
core.error(`Java setup process failed due to: ${message}`);
if (typeof (error === null || error === void 0 ? void 0 : error.code) === 'string') {
core.debug(error.stack);
}
const errorDetails = Object.assign({ name: error.name, message: error.message }, Object.getOwnPropertyNames(error)
.filter(prop => !['name', 'message', 'stack'].includes(prop))
.reduce((acc, prop) => {
acc[prop] = error[prop];
return acc;
}, {}));
Object.entries(errorDetails).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
throw error;
} }
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
throw error;
} }
} }
if (!foundJava) {
throw new Error('Failed to resolve Java version');
}
// JDK folder may contain postfix "Contents/Home" on macOS // JDK folder may contain postfix "Contents/Home" on macOS
const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX); const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) { if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) {
@@ -131520,9 +131587,9 @@ class SapMachineDistribution extends base_installer_1.JavaBase {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const platform = this.getPlatformOption(); const platform = this.getPlatformOption();
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
let fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json'); let fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sapmachine.io/assets/data/sapmachine-releases-all.json');
if (!fetchedReleasesJson) { if (!fetchedReleasesJson) {
fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://api.github.com/repos/SAP/SapMachine/contents/assets/data/sapmachine-releases-all.json?ref=gh-pages', (0, util_1.getGitHubHttpHeaders)()); fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json');
} }
if (!fetchedReleasesJson) { if (!fetchedReleasesJson) {
throw new Error(`Couldn't fetch SapMachine versions information from both primary and backup urls`); throw new Error(`Couldn't fetch SapMachine versions information from both primary and backup urls`);
@@ -132739,7 +132806,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
const versionFileName = getFileName(versionFile); const versionFileName = getFileName(versionFile);
if (versionFileName == '.tool-versions') { if (versionFileName == '.tool-versions') {
javaVersionRegExp = javaVersionRegExp =
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(-ea(\.\d+)?)?)$/m; /^java\s+(?:\S*-)?(?<version>\d+(?:\.\d+)*([+_.-](?:openj9[-._]?\d[\w.-]*|java\d+|jre[-_\w]*|OpenJDK\d+[\w_.-]*|[a-z0-9]+))*)/im;
} }
else { else {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;

View File

@@ -31,8 +31,8 @@ Inputs `java-version` and `distribution` are mandatory and needs to be provided.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -44,8 +44,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
java-version: '11' java-version: '11'
@@ -56,8 +56,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'zulu' distribution: 'zulu'
java-version: '21' java-version: '21'
@@ -69,8 +69,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'liberica' distribution: 'liberica'
java-version: '21' java-version: '21'
@@ -82,8 +82,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'microsoft' distribution: 'microsoft'
java-version: '21' java-version: '21'
@@ -97,7 +97,7 @@ steps:
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action: To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
```yaml ```yaml
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
token: ${{ secrets.GH_DOTCOM_TOKEN }} token: ${{ secrets.GH_DOTCOM_TOKEN }}
distribution: 'microsoft' distribution: 'microsoft'
@@ -111,8 +111,8 @@ If the runner is not able to access github.com, any Java versions requested duri
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'corretto' distribution: 'corretto'
java-version: '21' java-version: '21'
@@ -124,8 +124,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'oracle' distribution: 'oracle'
java-version: '21' java-version: '21'
@@ -137,8 +137,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'dragonwell' distribution: 'dragonwell'
java-version: '8' java-version: '8'
@@ -149,8 +149,8 @@ steps:
**NOTE:** An OpenJDK release maintained and supported by SAP **NOTE:** An OpenJDK release maintained and supported by SAP
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'sapmachine' distribution: 'sapmachine'
java-version: '21' java-version: '21'
@@ -162,8 +162,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'graalvm' distribution: 'graalvm'
java-version: '21' java-version: '21'
@@ -181,8 +181,8 @@ For example, `11.0.24` is not available but `11.0.16` is.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jetbrains' distribution: 'jetbrains'
java-version: '11' java-version: '11'
@@ -194,8 +194,8 @@ GitHub token to the action to increase the rate limit. Set the `GITHUB_TOKEN` en
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jetbrains' distribution: 'jetbrains'
java-version: '17' java-version: '17'
@@ -219,8 +219,8 @@ The available package types are:
## Installing custom Java package type ## Installing custom Java package type
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -232,8 +232,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -249,7 +249,7 @@ steps:
- run: | - run: |
download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz" download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -275,7 +275,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver') latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver')
echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT" echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT"
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -296,9 +296,9 @@ jobs:
java: [ '8', '11' ] java: [ '8', '11' ]
name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@@ -316,9 +316,9 @@ jobs:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@@ -333,9 +333,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -349,7 +349,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
- name: Set up Apache Maven Central - name: Set up Apache Maven Central
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: # running setup-java again overwrites the settings.xml with: # running setup-java again overwrites the settings.xml
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
@@ -446,9 +446,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up JDK 11 for Shared Runner - name: Set up JDK 11 for Shared Runner
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -472,10 +472,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -509,14 +509,14 @@ Subsequent calls to `setup-java` with distinct distribution and version paramete
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
8 8
11 11
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '15' java-version: '15'
@@ -528,7 +528,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi
- run: | - run: |
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz" download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -545,7 +545,7 @@ Each JDK provider will receive a default `vendor` using the `distribution` input
- run: | - run: |
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz" download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -560,7 +560,7 @@ In case you install multiple versions of Java at once with multi-line `java-vers
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@@ -574,8 +574,8 @@ Each JDK provider will receive a default `id` based on the combination of `distr
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
@@ -587,7 +587,7 @@ In case you install multiple versions of Java at once you can use the same synta
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@@ -614,5 +614,9 @@ major versions: 8, 11, 16, 17, 21
more specific versions: 8.0.282+8, 8.0.232, 11.0, 11.0.4, 17.0 more specific versions: 8.0.282+8, 8.0.232, 11.0, 11.0.4, 17.0
early access (EA) versions: 15-ea, 15.0.0-ea early access (EA) versions: 15-ea, 15.0.0-ea
versions with specified distribution: openjdk64-11.0.2 versions with specified distribution: openjdk64-11.0.2
LTS versions : temurin-21.0.5+11.0.LTS
``` ```
If the file contains multiple versions, only the first one will be recognized. If the file contains multiple versions, only the first one will be recognized.
***NOTE***:
For the tool-version file, ensure that you use standard semantic versioning (semver) formats, as non-standard formats (such as jetbrains-21b212.1) may not be parsed correctly. Additionally, for complex version strings containing multiple version-like segments (for example, java semeru-openj9-11.0.15+10_openj9-0.32.0), the extraction logic may incorrectly capture the last segment (0.32.0) instead of the main version (11.0.15+10).

123
package-lock.json generated
View File

@@ -17,7 +17,7 @@
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"semver": "^7.6.0", "semver": "^7.6.0",
"xmlbuilder2": "^2.4.0" "xmlbuilder2": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
@@ -32,7 +32,7 @@
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"prettier": "^2.8.4", "prettier": "^3.6.2",
"ts-jest": "^29.3.0", "ts-jest": "^29.3.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },
@@ -978,10 +978,11 @@
} }
}, },
"node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": { "node_modules/@istanbuljs/load-nyc-config/node_modules/js-yaml": {
"version": "3.14.1", "version": "3.14.2",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.2.tgz",
"integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "integrity": "sha512-PMSmkqxr106Xa156c2M265Z+FTrPl+oxd/rgOQy2tijQeK5TxQ43psO1ZCwhVOSdnn+RzkzlRz/eY4BgJBYVpg==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"argparse": "^1.0.7", "argparse": "^1.0.7",
"esprima": "^4.0.0" "esprima": "^4.0.0"
@@ -1409,47 +1410,51 @@
} }
}, },
"node_modules/@oozcitak/dom": { "node_modules/@oozcitak/dom": {
"version": "1.15.8", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/@oozcitak/dom/-/dom-1.15.8.tgz", "resolved": "https://registry.npmjs.org/@oozcitak/dom/-/dom-2.0.1.tgz",
"integrity": "sha512-MoOnLBNsF+ok0HjpAvxYxR4piUhRDCEWK0ot3upwOOHYudJd30j6M+LNcE8RKpwfnclAX9T66nXXzkytd29XSw==", "integrity": "sha512-Un5k8MKqGak1LQM/behcHylmGdRopBXZax19weVedEAIrOCRZooY+MvX4Ehcz0ftOEPgYZ7vjIm/+MokVBFO3w==",
"license": "MIT",
"dependencies": { "dependencies": {
"@oozcitak/infra": "1.0.8", "@oozcitak/infra": "^2.0.1",
"@oozcitak/url": "1.0.4", "@oozcitak/url": "^2.0.1",
"@oozcitak/util": "8.3.8" "@oozcitak/util": "^9.0.2"
}, },
"engines": { "engines": {
"node": ">=8.0" "node": ">=20.0"
} }
}, },
"node_modules/@oozcitak/infra": { "node_modules/@oozcitak/infra": {
"version": "1.0.8", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/@oozcitak/infra/-/infra-1.0.8.tgz", "resolved": "https://registry.npmjs.org/@oozcitak/infra/-/infra-2.0.1.tgz",
"integrity": "sha512-JRAUc9VR6IGHOL7OGF+yrvs0LO8SlqGnPAMqyzOuFZPSZSXI7Xf2O9+awQPSMXgIWGtgUf/dA6Hs6X6ySEaWTg==", "integrity": "sha512-TtjI+kducm0ExL3OTKglPLkAIQ3alq0Otbokml62haZESfQaL3ojLJxl7+UTBhWCkBBuCshzGEEYmX5MXo8WOg==",
"license": "MIT",
"dependencies": { "dependencies": {
"@oozcitak/util": "8.3.8" "@oozcitak/util": "~9.0.2"
}, },
"engines": { "engines": {
"node": ">=6.0" "node": ">=20.0"
} }
}, },
"node_modules/@oozcitak/url": { "node_modules/@oozcitak/url": {
"version": "1.0.4", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/@oozcitak/url/-/url-1.0.4.tgz", "resolved": "https://registry.npmjs.org/@oozcitak/url/-/url-2.0.1.tgz",
"integrity": "sha512-kDcD8y+y3FCSOvnBI6HJgl00viO/nGbQoCINmQ0h98OhnGITrWR3bOGfwYCthgcrV8AnTJz8MzslTQbC3SOAmw==", "integrity": "sha512-lLHUQUyYy86q+qbALr0TMVh+VQAYwNGbsxBx4LhfjvkNYG0hgAwWtq7ePebGs2nEhZmmIFl24ikuCpH2r5d3+A==",
"license": "MIT",
"dependencies": { "dependencies": {
"@oozcitak/infra": "1.0.8", "@oozcitak/infra": "^2.0.1",
"@oozcitak/util": "8.3.8" "@oozcitak/util": "^9.0.2"
}, },
"engines": { "engines": {
"node": ">=8.0" "node": ">=20.0"
} }
}, },
"node_modules/@oozcitak/util": { "node_modules/@oozcitak/util": {
"version": "8.3.8", "version": "9.0.4",
"resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-8.3.8.tgz", "resolved": "https://registry.npmjs.org/@oozcitak/util/-/util-9.0.4.tgz",
"integrity": "sha512-T8TbSnGsxo6TDBJx/Sgv/BlVJL3tshxZP7Aq5R1mSnM5OcHY2dQaxLMu2+E8u3gN0MLOzdjurqN4ZRVuzQycOQ==", "integrity": "sha512-kmx1hRJlsvxiTCpK97off59LqSEOtkWOPe4rdfFL8TjZtihYSTVNObIfc86jtLngfnuIuuTRt+TUCgRS220RSQ==",
"license": "MIT",
"engines": { "engines": {
"node": ">=8.0" "node": ">=20.0"
} }
}, },
"node_modules/@opentelemetry/api": { "node_modules/@opentelemetry/api": {
@@ -2114,8 +2119,7 @@
"node_modules/argparse": { "node_modules/argparse": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="
"dev": true
}, },
"node_modules/async": { "node_modules/async": {
"version": "3.2.6", "version": "3.2.6",
@@ -2962,6 +2966,7 @@
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
"dev": true,
"bin": { "bin": {
"esparse": "bin/esparse.js", "esparse": "bin/esparse.js",
"esvalidate": "bin/esvalidate.js" "esvalidate": "bin/esvalidate.js"
@@ -4301,10 +4306,10 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/js-yaml": { "node_modules/js-yaml": {
"version": "4.1.0", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz",
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==",
"dev": true, "license": "MIT",
"dependencies": { "dependencies": {
"argparse": "^2.0.1" "argparse": "^2.0.1"
}, },
@@ -4876,15 +4881,16 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "2.8.8", "version": "3.6.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz",
"integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true, "dev": true,
"license": "MIT",
"bin": { "bin": {
"prettier": "bin-prettier.js" "prettier": "bin/prettier.cjs"
}, },
"engines": { "engines": {
"node": ">=10.13.0" "node": ">=14"
}, },
"funding": { "funding": {
"url": "https://github.com/prettier/prettier?sponsor=1" "url": "https://github.com/prettier/prettier?sponsor=1"
@@ -5213,7 +5219,8 @@
"node_modules/sprintf-js": { "node_modules/sprintf-js": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==" "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==",
"dev": true
}, },
"node_modules/stack-utils": { "node_modules/stack-utils": {
"version": "2.0.6", "version": "2.0.6",
@@ -5662,38 +5669,18 @@
} }
}, },
"node_modules/xmlbuilder2": { "node_modules/xmlbuilder2": {
"version": "2.4.1", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/xmlbuilder2/-/xmlbuilder2-2.4.1.tgz", "resolved": "https://registry.npmjs.org/xmlbuilder2/-/xmlbuilder2-4.0.0.tgz",
"integrity": "sha512-vliUplZsk5vJnhxXN/mRcij/AE24NObTUm/Zo4vkLusgayO6s3Et5zLEA14XZnY1c3hX5o1ToR0m0BJOPy0UvQ==", "integrity": "sha512-zIoY033NGmbzHX1cYOGKNfeWpZyiGLzXGHNoxQ6tR/R+WqT7mqz+EDtFdPwqnhIms6vHz9BNtMS47DiGPyGfwg==",
"license": "MIT",
"dependencies": { "dependencies": {
"@oozcitak/dom": "1.15.8", "@oozcitak/dom": "^2.0.1",
"@oozcitak/infra": "1.0.8", "@oozcitak/infra": "^2.0.1",
"@oozcitak/util": "8.3.8", "@oozcitak/util": "^9.0.4",
"@types/node": "*", "js-yaml": "^4.1.0"
"js-yaml": "3.14.0"
}, },
"engines": { "engines": {
"node": ">=10.0" "node": ">=20.0"
}
},
"node_modules/xmlbuilder2/node_modules/argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
"dependencies": {
"sprintf-js": "~1.0.2"
}
},
"node_modules/xmlbuilder2/node_modules/js-yaml": {
"version": "3.14.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz",
"integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==",
"dependencies": {
"argparse": "^1.0.7",
"esprima": "^4.0.0"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
} }
}, },
"node_modules/y18n": { "node_modules/y18n": {

View File

@@ -4,7 +4,7 @@
"private": true, "private": true,
"description": "setup java action", "description": "setup java action",
"main": "dist/setup/index.js", "main": "dist/setup/index.js",
"engines": { "engines": {
"node": ">=24.0.0" "node": ">=24.0.0"
}, },
"scripts": { "scripts": {
@@ -37,7 +37,7 @@
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"semver": "^7.6.0", "semver": "^7.6.0",
"xmlbuilder2": "^2.4.0" "xmlbuilder2": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
@@ -52,7 +52,7 @@
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"prettier": "^2.8.4", "prettier": "^3.6.2",
"ts-jest": "^29.3.0", "ts-jest": "^29.3.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },

View File

@@ -51,39 +51,115 @@ export abstract class JavaBase {
core.info(`Resolved Java ${foundJava.version} from tool-cache`); core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else { } else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
try { const MAX_RETRIES = 4;
const javaRelease = await this.findPackageForDownload(this.version); const RETRY_DELAY_MS = 2000;
core.info(`Resolved latest version as ${javaRelease.version}`); const retryableCodes = [
if (foundJava?.version === javaRelease.version) { 'ETIMEDOUT',
core.info(`Resolved Java ${foundJava.version} from tool-cache`); 'ECONNRESET',
} else { 'ENOTFOUND',
core.info('Trying to download...'); 'ECONNREFUSED'
foundJava = await this.downloadTool(javaRelease); ];
core.info(`Java ${foundJava.version} was downloaded`); let retries = MAX_RETRIES;
} while (retries > 0) {
} catch (error: any) { try {
if (error instanceof tc.HTTPError) { // Clear console timers before each attempt to prevent conflicts
if (error.httpStatusCode === 403) { if (retries < MAX_RETRIES && core.isDebug()) {
core.error('HTTP 403: Permission denied or access restricted.'); const consoleAny = console as any;
} else if (error.httpStatusCode === 429) { consoleAny._times?.clear?.();
core.warning('HTTP 429: Rate limit exceeded. Please retry later.');
} else {
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
} }
} else { const javaRelease = await this.findPackageForDownload(this.version);
const message = core.info(`Resolved latest version as ${javaRelease.version}`);
error instanceof Error ? error.message : JSON.stringify(error); if (foundJava?.version === javaRelease.version) {
core.error( core.info(`Resolved Java ${foundJava.version} from tool-cache`);
`Java setup failed due to network issue or timeout: ${message}` } else {
); core.info('Trying to download...');
foundJava = await this.downloadTool(javaRelease);
core.info(`Java ${foundJava.version} was downloaded`);
}
break;
} catch (error: any) {
retries--;
// Check if error is retryable (including aggregate errors)
const isRetryable =
(error instanceof tc.HTTPError &&
error.httpStatusCode &&
[429, 502, 503, 504].includes(error.httpStatusCode)) ||
retryableCodes.includes(error?.code) ||
(error?.errors &&
Array.isArray(error.errors) &&
error.errors.some((err: any) =>
retryableCodes.includes(err?.code)
));
if (retries > 0 && isRetryable) {
core.debug(
`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`
);
await new Promise(r => setTimeout(r, RETRY_DELAY_MS));
continue;
}
if (error instanceof tc.HTTPError) {
if (error.httpStatusCode === 403) {
core.error('HTTP 403: Permission denied or access restricted.');
} else if (error.httpStatusCode === 429) {
core.warning(
'HTTP 429: Rate limit exceeded. Please retry later.'
);
} else {
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
}
} else if (error && error.errors && Array.isArray(error.errors)) {
core.error(
`Java setup failed due to network or configuration error(s)`
);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
for (const err of error.errors) {
const endpoint = err?.address || err?.hostname || '';
const port = err?.port ? `:${err.port}` : '';
const message = err?.message || 'Aggregate error';
const endpointInfo = !message.includes(endpoint)
? ` ${endpoint}${port}`
: '';
const localInfo =
err.localAddress && err.localPort
? ` - Local (${err.localAddress}:${err.localPort})`
: '';
const logMessage = `${message}${endpointInfo}${localInfo}`;
core.error(logMessage);
core.debug(`${err.stack || err.message}`);
Object.entries(err).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
} else {
const message =
error instanceof Error ? error.message : JSON.stringify(error);
core.error(`Java setup process failed due to: ${message}`);
if (typeof error?.code === 'string') {
core.debug(error.stack);
}
const errorDetails = {
name: error.name,
message: error.message,
...Object.getOwnPropertyNames(error)
.filter(prop => !['name', 'message', 'stack'].includes(prop))
.reduce<{[key: string]: any}>((acc, prop) => {
acc[prop] = error[prop];
return acc;
}, {})
};
Object.entries(errorDetails).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
throw error;
} }
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
throw error;
} }
} }
if (!foundJava) {
throw new Error('Failed to resolve Java version');
}
// JDK folder may contain postfix "Contents/Home" on macOS // JDK folder may contain postfix "Contents/Home" on macOS
const macOSPostfixPath = path.join( const macOSPostfixPath = path.join(
foundJava.path, foundJava.path,

View File

@@ -1,90 +1,133 @@
[ [
{ {
"version": "21.0.2", "version": "25.0.0",
"stable": true, "stable": true,
"release_url": "https://aka.ms/download-jdk", "release_url": "https://aka.ms/download-jdk",
"files": [ "files": [
{ {
"filename": "microsoft-jdk-21.0.2-macos-x64.tar.gz", "filename": "microsoft-jdk-25.0.0-macos-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-linux-x64.tar.gz", "filename": "microsoft-jdk-25.0.0-linux-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-windows-x64.zip", "filename": "microsoft-jdk-25.0.0-windows-x64.zip",
"arch": "x64", "arch": "x64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-x64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-x64.zip"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-macos-aarch64.tar.gz", "filename": "microsoft-jdk-25.0.0-macos-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-linux-aarch64.tar.gz", "filename": "microsoft-jdk-25.0.0-linux-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-windows-aarch64.zip", "filename": "microsoft-jdk-25.0.0-windows-aarch64.zip",
"arch": "aarch64", "arch": "aarch64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-aarch64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-aarch64.zip"
} }
] ]
}, },
{ {
"version": "21.0.1", "version": "21.0.2",
"stable": true, "stable": true,
"release_url": "https://aka.ms/download-jdk", "release_url": "https://aka.ms/download-jdk",
"files": [ "files": [
{ {
"filename": "microsoft-jdk-21.0.1-macos-x64.tar.gz", "filename": "microsoft-jdk-21.0.2-macos-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-linux-x64.tar.gz", "filename": "microsoft-jdk-21.0.2-linux-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-windows-x64.zip", "filename": "microsoft-jdk-21.0.2-windows-x64.zip",
"arch": "x64", "arch": "x64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-x64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-x64.zip"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-macos-aarch64.tar.gz", "filename": "microsoft-jdk-21.0.2-macos-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-linux-aarch64.tar.gz", "filename": "microsoft-jdk-21.0.2-linux-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-windows-aarch64.zip", "filename": "microsoft-jdk-21.0.2-windows-aarch64.zip",
"arch": "aarch64", "arch": "aarch64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-aarch64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-aarch64.zip"
} }
] ]
}, },
{
"version": "21.0.1",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-21.0.1-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.1-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.1-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-x64.zip"
},
{
"filename": "microsoft-jdk-21.0.1-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.1-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.1-windows-aarch64.zip",
"arch": "aarch64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-aarch64.zip"
}
]
},
{ {
"version": "21.0.0", "version": "21.0.0",
"stable": true, "stable": true,
@@ -176,42 +219,42 @@
"stable": true, "stable": true,
"release_url": "https://aka.ms/download-jdk", "release_url": "https://aka.ms/download-jdk",
"files": [ "files": [
{ {
"filename": "microsoft-jdk-17.0.9-macos-x64.tar.gz", "filename": "microsoft-jdk-17.0.9-macos-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-linux-x64.tar.gz", "filename": "microsoft-jdk-17.0.9-linux-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-windows-x64.zip", "filename": "microsoft-jdk-17.0.9-windows-x64.zip",
"arch": "x64", "arch": "x64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-x64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-x64.zip"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-macos-aarch64.tar.gz", "filename": "microsoft-jdk-17.0.9-macos-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-linux-aarch64.tar.gz", "filename": "microsoft-jdk-17.0.9-linux-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-windows-aarch64.zip", "filename": "microsoft-jdk-17.0.9-windows-aarch64.zip",
"arch": "aarch64", "arch": "aarch64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-aarch64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-aarch64.zip"
} }
] ]
}, },
{ {

View File

@@ -8,7 +8,6 @@ import {
convertVersionToSemver, convertVersionToSemver,
extractJdkFile, extractJdkFile,
getDownloadArchiveExtension, getDownloadArchiveExtension,
getGitHubHttpHeaders,
isVersionSatisfies, isVersionSatisfies,
renameWinArchive renameWinArchive
} from '../../util'; } from '../../util';
@@ -64,13 +63,12 @@ export class SapMachineDistribution extends JavaBase {
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
let fetchedReleasesJson = await this.fetchReleasesFromUrl( let fetchedReleasesJson = await this.fetchReleasesFromUrl(
'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json' 'https://sapmachine.io/assets/data/sapmachine-releases-all.json'
); );
if (!fetchedReleasesJson) { if (!fetchedReleasesJson) {
fetchedReleasesJson = await this.fetchReleasesFromUrl( fetchedReleasesJson = await this.fetchReleasesFromUrl(
'https://api.github.com/repos/SAP/SapMachine/contents/assets/data/sapmachine-releases-all.json?ref=gh-pages', 'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json'
getGitHubHttpHeaders()
); );
} }

View File

@@ -59,9 +59,8 @@ export async function createToolchainsSettings({
// when an alternate m2 location is specified use only that location (no .m2 directory) // when an alternate m2 location is specified use only that location (no .m2 directory)
// otherwise use the home/.m2/ path // otherwise use the home/.m2/ path
await io.mkdirP(settingsDirectory); await io.mkdirP(settingsDirectory);
const originalToolchains = await readExistingToolchainsFile( const originalToolchains =
settingsDirectory await readExistingToolchainsFile(settingsDirectory);
);
const updatedToolchains = generateToolchainDefinition( const updatedToolchains = generateToolchainDefinition(
originalToolchains, originalToolchains,
jdkInfo.version, jdkInfo.version,

View File

@@ -133,7 +133,7 @@ export function getVersionFromFileContent(
const versionFileName = getFileName(versionFile); const versionFileName = getFileName(versionFile);
if (versionFileName == '.tool-versions') { if (versionFileName == '.tool-versions') {
javaVersionRegExp = javaVersionRegExp =
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(-ea(\.\d+)?)?)$/m; /^java\s+(?:\S*-)?(?<version>\d+(?:\.\d+)*([+_.-](?:openj9[-._]?\d[\w.-]*|java\d+|jre[-_\w]*|OpenJDK\d+[\w_.-]*|[a-z0-9]+))*)/im;
} else { } else {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
} }