Update readme and test matrix (#209) · actions/setup-java@c21fb93 (original) (raw)

`@@ -15,32 +15,21 @@ This action provides the following functionality for GitHub Actions runners:

`

15

15

`- Caching dependencies managed by Gradle

`

16

16

``

17

17

`## V2 vs V1

`

18

``

`-

`

``

18

`+

`

19

19

`- V2 requires you to specify distribution along with the version. V1 defaults to Zulu OpenJDK, only version input is required. Follow the migration guide to switch from V1 to V2

`

20

20

``

21

21

`## Usage

`

22

22

`` Inputs java-version and distribution are mandatory. See Supported distributions section for a list of available options.

``

23

23

``

24

24

`### Basic

`

25

``

`-

Adopt OpenJDK

`

26

``


```yaml

27

``

`-

steps:

`

28

``

`-

`

29

``

`-

`

30

``

`-

with:

`

31

``

`-

distribution: 'adopt' # See 'Supported distributions' for available options

`

32

``

`-

java-version: '11'

`

33

``

`-

`

34

``


```

35

``

-

36

25

`Eclipse Temurin

`

37

26

```` ```yaml


`38`

`27`

`steps:

`

`39`

`28`

`- uses: actions/checkout@v2

`

`40`

`29`

`- uses: actions/setup-java@v2

`

`41`

`30`

`with:

`

`42`

`31`

`distribution: 'temurin' # See 'Supported distributions' for available options

`

`43`

``

`-

java-version: '8'

`

``

`32`

`+

java-version: '11'

`

`44`

`33`

`- run: java -cp java HelloWorldApp

`

`45`

`34`

```` ```

46

35

``

`@@ -57,34 +46,51 @@ steps:

`

57

46

``

58

47

`#### Supported version syntax

`

59

48

`` The java-version input supports an exact version or a version range using SemVer notation:

``

60

``

`` -

``

``

49

`` +

``

61

50

`` - more specific versions: 11.0, 11.0.4, 8.0.232, 8.0.282+8

``

62

51

`` - early access (EA) versions: 15-ea, 15.0.0-ea, 15.0.0-ea.2, 15.0.0+2-ea

``

63

52

``

64

53

`#### Supported distributions

`

65

54

`Currently, the following distributions are supported:

`

66

``

`-

| Keyword | Distribution | Official site | License |

`

``

55

`+

| Keyword | Distribution | Official site | License

`

67

56

`|-|-|-|-|

`

``

57

`` +

| temurin | Eclipse Temurin | Link | Link

``

68

58

`` | zulu | Zulu OpenJDK | Link | Link |

``

69

``

`` -

| adopt or adopt-hotspot | Adopt OpenJDK Hotspot | Link | Link

``

``

59

`` +

| adopt or adopt-hotspot | Adopt OpenJDK Hotspot | Link | Link |

``

70

60

`` | adopt-openj9 | Adopt OpenJDK OpenJ9 | Link | Link

``

71

``

`` -

| temurin | Eclipse Temurin | Link | Link

``

72

61

``

73

62

`NOTE: The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions.

`

74

63

``

75

``

`-

Supported cache types

`

76

``

`` -

Currently, gradle and maven are supported. You can set cache input like below:

``

``

64

`` +

NOTE: Adopt OpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from adopt to temurin to keep receiving software and security updates. See more details in the Good-bye AdoptOpenJDK post.

``

``

65

+

``

66

`+

Caching packages dependencies

`

``

67

`+

The action has a built-in functionality for caching and restoring dependencies. It uses actions/cache under hood for caching dependencies but requires less configuration settings. Supported package managers are gradle and maven. The cache input is optional, and caching is turned off by default.

`

``

68

+

``

69

`+

Caching gradle dependencies

`

77

70

```` ```yaml


`78`

`71`

`steps:

`

`79`

`72`

`- uses: actions/checkout@v2

`

`80`

`73`

`- uses: actions/setup-java@v2

`

`81`

`74`

` with:

`

`82`

``

`-

distribution: 'adopt'

`

``

`75`

`+

distribution: 'temurin'

`

`83`

`76`

` java-version: '11'

`

`84`

``

`-

cache: 'gradle' # will restore cache of dependencies and wrappers

`

``

`77`

`+

cache: 'gradle'

`

`85`

`78`

`- run: ./gradlew build

`

`86`

`79`

```` ```

87

80

``

``

81

`+

Caching maven dependencies

`

``

82


```yaml

``

83

`+

steps:

`

``

84

`+

`

``

85

`+

`

``

86

`+

with:

`

``

87

`+

distribution: 'temurin'

`

``

88

`+

java-version: '11'

`

``

89

`+

cache: 'maven'

`

``

90

`+

`

``

91

`+

run: mvn -B package --file pom.xml

`

``

92


```

``

93

+

88

94

`### Check latest

`

89

95

`` In the basic examples above, the check-latest flag defaults to false. When set to false, the action tries to first resolve a version of Java from the local tool cache on the runner. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set check-latest to false if you prefer a faster more consistent setup experience that prioritizes trying to use the cached versions at the expense of newer versions sometimes being available for download.

``

90

96

``

`@@ -125,6 +131,7 @@ jobs:

`

125

131

``

126

132

`### Advanced

`

127

133

`- Selecting a Java distribution

`

``

134

`+

`

128

135

` - Adopt

`

129

136

` - Zulu

`

130

137

`- Installing custom Java package type

`