Skip to content

Commit 02f9c1e

Browse files
brunoborgesCopilot
andcommitted
docs: clarify sdkmanrc distribution inference scope
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bdc498b commit 02f9c1e

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ For information about the latest releases, recent updates, and newly supported d
3636

3737
- `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.
3838

39-
- `java-version-file`: The path to a file containing java version. Supported file types are `.java-version` and `.tool-versions`. See more details in [about .java-version-file](docs/advanced-usage.md#Java-version-file).
39+
- `java-version-file`: The path to a file containing java version. Supported file types are `.java-version`, `.tool-versions`, and `.sdkmanrc`. See more details in [about .java-version-file](docs/advanced-usage.md#Java-version-file).
4040

41-
- `distribution`: _(required)_ Java [distribution](#supported-distributions).
41+
- `distribution`: Java [distribution](#supported-distributions). Required unless `java-version-file` points to `.sdkmanrc` with a recognized distribution suffix (for example `java=21.0.5-tem`).
4242

4343
- `java-package`: The packaging variant of the chosen distribution. Possible values: `jdk`, `jre`, `jdk+fx`, `jre+fx`. Default value: `jdk`.
4444

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
description: 'The path to a file containing the Java version to set up (.java-version, .tool-versions, .sdkmanrc). Used when java-version is not set. See examples of supported syntax in README file'
1111
required: false
1212
distribution:
13-
description: 'Java distribution. See the list of supported distributions in README file. When using .sdkmanrc with a distribution suffix (e.g., java=21.0.5-tem), this input is optional.'
13+
description: 'Java distribution. See the list of supported distributions in README file. This input is required except when java-version-file points to .sdkmanrc with a recognized distribution suffix (e.g., java=21.0.5-tem).'
1414
required: false
1515
java-package:
1616
description: 'The package type (jdk, jre, jdk+fx, jre+fx)'

docs/advanced-usage.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -604,18 +604,17 @@ steps:
604604
Supported files are `.java-version`, `.tool-versions` and `.sdkmanrc`.
605605
* 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).
606606
* 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-
* 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.
607+
* In `.sdkmanrc` file, java version should be preceded by the `java=` prefix (e.g., `java=17.0.7-tem`). When a recognized SDKMAN distribution suffix is present, setup-java can infer the `distribution` input automatically. Supported suffix mappings are: `tem` -> `temurin`, `sem` -> `semeru`, `albba`/`dragonwell` -> `dragonwell`, `zulu` -> `zulu`, `amzn` -> `corretto`, `graal`/`graalce` -> `graalvm`, `librca` -> `liberica`, `ms` -> `microsoft`, `oracle` -> `oracle`, `sapmchn` -> `sapmachine`, `jbr` -> `jetbrains`. Unrecognized suffixes require setting `distribution` explicitly. 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.
608608

609609

610610
If both `java-version` and `java-version-file` **inputs** are provided, the `java-version` input will be used.
611611

612-
**Example step using `Sdkman!`**:
612+
**Example step using `Sdkman!`** (distribution inferred from `.sdkmanrc`):
613613
```yml
614614
- name: Setup java
615615
uses: actions/setup-java@v5
616616
with:
617617
java-version-file: '.sdkmanrc'
618-
distribution: 'temurin'
619618
```
620619

621620
**Example `.sdkmanrc`**:

0 commit comments

Comments
 (0)