/setup-jdk

Set up your GitHub Actions workflow with a specific version of Java (AdoptOpenJDK)

Primary LanguageTypeScriptMIT LicenseMIT

setup-jdk

This action sets up a Java development environment with the OpenJDK distribution from AdoptOpenJDK for use in actions by:

  • Downloading and caching a version of the OpenJDK by version and adding to PATH. Downloads from AdoptOpenJDK.
  • Registering problem matchers for error output.

The action is based on actions/setup-java and is using the AdoptOpenJDK API for fetching the JDK binaries. It's also a fork from https://github.com/joschi/setup-jdk, trying to improve the reliability.

Usage

See action.yml

Basic:

steps:
- uses: actions/checkout@latest
  uses: cescoffier/setup-jdk@v1.1.2
  with:
    java_version: '11' // The OpenJDK version to make available on the path
    architecture: 'x64' // defaults to 'x64'
- run: java -cp java HelloWorldApp

Matrix Testing:

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        java: [ '8', '11', '13' ]
    name: Java ${{ matrix.java }} sample
    steps:
      - uses: actions/checkout@master
      - name: Setup java
        uses: cescoffier/setup-jdk@v1.1.2
        with:
          java_version: ${{ matrix.java }}
          architecture: x64
      - run: java -cp java HelloWorldApp

License

The scripts and documentation in this project are released under the MIT License.

Contributions

Contributions are welcome! See Contributor's Guide