Search code examples
github-actionscorretto

How to use Amazon Corretto JDK with Github Actions?


I have a Github Java project that uses Amazon Corretto 11.

But I am not able to write a Github action so that workflow would build the project at every pull request.

For example, with OpenJDK it would look like below

# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 11
      uses: actions/setup-java@v2
      with:
        java-version: '11'
        distribution: 'adopt'
    - name: Build with Maven
      run: mvn -B package --file pom.xml

How to use Corretto instead of OpenJDK? Is there a Github standard action to do that? Or any other way?


Solution

  • If you want to use that action you would probably need to submit a PR to the action to add Coretto as a supported distribution.

    I am curious why it matters though? You should be able to build using any Java distribution. Is there a reason you think you need to build using Correto?