在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:actions/setup-java开源软件地址:https://github.com/actions/setup-java开源编程语言:TypeScript 99.1%开源软件介绍:setup-javaThis action provides the following functionality for GitHub Actions runners:
V2 vs V1
UsageInputs BasicEclipse Temurin steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'
- run: java -cp java HelloWorldApp Zulu OpenJDK steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
- run: java -cp java HelloWorldApp Supported version syntaxThe
Supported distributionsCurrently, the following distributions are supported:
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. NOTE: Adopt OpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from NOTE: For Zulu OpenJDK architectures x64 and arm64 are mapped to x86 / arm with proper hw_bitness. Caching packages dependenciesThe 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, maven and sbt. The format of the used cache key is
The workflow output The cache input is optional, and caching is turned off by default. Caching gradle dependenciessteps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- run: ./gradlew build --no-daemon Caching maven dependenciessteps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'maven'
- name: Build with Maven
run: mvn -B package --file pom.xml Caching sbt dependenciessteps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
cache: 'sbt'
- name: Build with SBT
run: sbt package Check latestIn the basic examples above, the If For Java distributions that are not cached on Hosted images, steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '11'
check-latest: true
- run: java -cp java HelloWorldApp Testing against different Java versionsjobs:
build:
runs-on: ubuntu-20.04
strategy:
matrix:
java: [ '8', '11', '13', '15' ]
name: Java ${{ matrix.Java }} sample
steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: '<distribution>'
java-version: ${{ matrix.java }}
- run: java -cp java HelloWorldApp Advanced
LicenseThe scripts and documentation in this project are released under the MIT License. ContributionsContributions are welcome! See Contributor's Guide |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论