You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/advanced-usage.md
+21-11Lines changed: 21 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -602,16 +602,26 @@ steps:
602
602
If the `java-version-file` input is specified, the action will extract the version from the file and install it.
603
603
604
604
Supported files are `.java-version`, `.tool-versions` and `.sdkmanrc`.
605
-
In `.java-version` file, only the version should be specified (e.g., 17.0.7).
606
-
In `.tool-versions` file, java version should be preceded by the java keyword (e.g., java 17.0.7).
607
-
In `.sdkmanrc` file, java version should be preceded by the `java=` prefix (e.g., java=17.0.7-tem) and include the distribution.
608
-
The `.java-version` file recognizes all variants of the version description according to [jenv](https://github.com/jenv/jenv).
609
-
Similarly, the `.tool-versions` file supports version specifications in accordance with [asdf](https://github.com/asdf-vm/asdf)
610
-
standards, adhering to Semantic Versioning ([semver](https://semver.org/)).
611
-
The `.sdkmanrc` file supports version specifications in accordance with [file format](https://sdkman.io/usage#env-command),
612
-
see [Sdkman! documentation](https://sdkman.io/jdks) for more information.
613
-
614
-
If both java-version and java-version-file inputs are provided, the java-version input will be used.
605
+
* In `.java-version` file, only the version should be specified (e.g., 17.0.7). The `.java-version` file recognizes all variants of the version description according to [jenv](https://github.com/jenv/jenv).
606
+
* In `.tool-versions` file, java version should be preceded by the java keyword (e.g., java 17.0.7). The `.tool-versions` file supports version specifications in accordance with [asdf](https://github.com/asdf-vm/asdf) standards, adhering to Semantic Versioning ([semver](https://semver.org/)).
607
+
* (NEW) In `.sdkmanrc` file, java version should be preceded by the `java=` prefix (e.g., java=17.0.7-tem) and include the distribution. The `.sdkmanrc` file supports version specifications in accordance with [file format](https://sdkman.io/usage#env-command), see [Sdkman! documentation](https://sdkman.io/jdks) for more information.
608
+
609
+
610
+
If both `java-version` and `java-version-file` **inputs** are provided, the `java-version` input will be used.
611
+
612
+
**Example step using `Sdkman!`**:
613
+
```yml
614
+
- name: Setup java
615
+
uses: actions/setup-java@v5
616
+
with:
617
+
java-version-file: '.sdkmanrc'
618
+
distribution: 'temurin'
619
+
```
620
+
621
+
**Example `.sdkmanrc`**:
622
+
```
623
+
java=17.0.7-tem
624
+
```
615
625
616
626
Valid entry options (does not apply to `.sdkmanrc`):
If the file contains multiple versions, only the first one will be recognized.
625
635
626
636
***NOTE***:
627
-
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).
637
+
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).
0 commit comments