{"id":18488330,"url":"https://github.com/joschi/setup-jdk","last_synced_at":"2025-04-08T20:33:02.680Z","repository":{"id":39675537,"uuid":"211711061","full_name":"joschi/setup-jdk","owner":"joschi","description":"(DEPRECATED) Set up your GitHub Actions workflow with a specific version of AdoptOpenJDK","archived":true,"fork":false,"pushed_at":"2022-12-06T08:15:39.000Z","size":26460,"stargazers_count":30,"open_issues_count":8,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-03T04:04:46.930Z","etag":null,"topics":["action","actions","adoptopenjdk","github-action","github-actions","github-actions-java","java"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/setup-adoptopenjdk","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joschi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-29T18:57:21.000Z","updated_at":"2023-11-07T12:52:35.000Z","dependencies_parsed_at":"2023-01-04T12:19:04.472Z","dependency_job_id":null,"html_url":"https://github.com/joschi/setup-jdk","commit_stats":{"total_commits":180,"total_committers":27,"mean_commits":6.666666666666667,"dds":0.6944444444444444,"last_synced_commit":"1818212fcdf7eea4e09a6eb156c536640bf7b52f"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joschi%2Fsetup-jdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joschi%2Fsetup-jdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joschi%2Fsetup-jdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joschi%2Fsetup-jdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joschi","download_url":"https://codeload.github.com/joschi/setup-jdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247923623,"owners_count":21019029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["action","actions","adoptopenjdk","github-action","github-actions","github-actions-java","java"],"created_at":"2024-11-06T12:51:34.333Z","updated_at":"2025-04-08T20:33:02.665Z","avatar_url":"https://github.com/joschi.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# 🚨 Notice\n\nThe joschi/setup-jdk GitHub Action is deprecated.\n\nPlease consider switching to the official [actions/setup-java](https://github.com/actions/setup-java) action v2 or later which also supports AdoptOpenJDK and its successor Eclipse Temurin:\n\nhttps://github.com/actions/setup-java/tree/v2.5.0#basic\n\nIn order to migrate to [actions/setup-java](https://github.com/actions/setup-java) it is sufficient to replace the name of the action and set the `distribution` parameter to `temurin`.\n\n**Before:**\n\n```yaml\nsteps:\n- uses: actions/checkout@v2\n- uses: joschi/setup-jdk@v2\n  with:\n    java-version: '11' # The OpenJDK version to make available on the path\n    architecture: 'x64' # defaults to 'x64'\n- run: java -cp java HelloWorldApp\n```\n\n**After:**\n\n```yaml\nsteps:\n- uses: actions/checkout@v2\n- uses: actions/setup-java@v3\n  with:\n    distribution: 'temurin' # See 'Supported distributions' for available options\n    java-version: '11'\n    architecture: 'x64' # defaults to 'x64'\n- run: java -cp java HelloWorldApp\n```\n\n# setup-jdk\n\n\u003cp align=\"left\"\u003e\n  \u003ca href=\"https://github.com/joschi/setup-jdk\"\u003e\u003cimg alt=\"GitHub Actions status\" src=\"https://github.com/joschi/setup-jdk/workflows/Main%20workflow/badge.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nThis action sets up a Java development environment with the OpenJDK distribution from [AdoptOpenJDK](https://adoptopenjdk.net/) for use in actions by:\n\n- Downloading and caching a version of the OpenJDK by version and adding to `PATH`. Downloads from [AdoptOpenJDK](https://adoptopenjdk.net/).\n- Registering problem matchers for error output.\n\nThe action is based on [actions/setup-java](https://github.com/actions/setup-java) and is using the [AdoptOpenJDK API](https://api.adoptopenjdk.net/) for fetching the JDK binaries.\n\n# Usage\n\nSee [action.yml](action.yml)\n\n## Basic\n```yaml\nsteps:\n- uses: actions/checkout@v2\n- uses: joschi/setup-jdk@v2\n  with:\n    java-version: '11' # The OpenJDK version to make available on the path\n    architecture: 'x64' # defaults to 'x64'\n- run: java -cp java HelloWorldApp\n```\n\nExamples of version specifications that the java-version parameter will accept:\n\n- A major Java version\n\n  e.g. ```6, 7, 8, 9, 10, 11, 12, 13, ...```\n\n## Local file\n```yaml\nsteps:\n- uses: actions/checkout@v2\n- uses: joschi/setup-jdk@v2\n  with:\n    java-version: '4.0.0'\n    architecture: x64\n    jdkFile: \u003cpath to jdkFile\u003e # Optional - jdkFile to install java from. Useful for versions not found on Zulu Community CDN\n- run: java -cp java HelloWorldApp\n```\n\n## Matrix Testing\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        java: [ '8', '11', '13' ]\n    name: Java ${{ matrix.java }} sample\n    steps:\n      - uses: actions/checkout@v2\n      - name: Setup java\n        uses: joschi/setup-jdk@v2\n        with:\n          java-version: ${{ matrix.java }}\n          architecture: x64\n      - run: java -cp java HelloWorldApp\n```\n\n## Publishing using Apache Maven\n```yaml\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v2\n    - name: Set up JDK 1.8\n      uses: joschi/setup-jdk@v2\n      with:\n        java-version: '8'\n\n    - name: Build with Maven\n      run: mvn -B package --file pom.xml\n\n    - name: Publish to GitHub Packages Apache Maven\n      run: mvn deploy\n      env:\n        GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password\n\n    - name: Set up Apache Maven Central\n      uses: joschi/setup-jdk@v2\n      with: # running setup-jdk again overwrites the settings.xml\n        java-version: '8'\n        server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml\n        server-username: MAVEN_USERNAME # env variable for username in deploy\n        server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy\n        gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import\n        gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase\n\n    - name: Publish to Apache Maven Central\n      run: mvn deploy\n      env:\n        MAVEN_USERNAME: maven_username123\n        MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}\n        MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}\n```\n\nThe two `settings.xml` files created from the above example look like the following.\n\n`settings.xml` file created for the first deploy to GitHub Packages\n```xml\n\u003csettings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd\"\u003e\n  \u003cservers\u003e\n    \u003cserver\u003e\n      \u003cid\u003egithub\u003c/id\u003e\n      \u003cusername\u003e${env.GITHUB_ACTOR}\u003c/username\u003e\n      \u003cpassword\u003e${env.GITHUB_TOKEN}\u003c/password\u003e\n    \u003c/server\u003e\n    \u003cserver\u003e\n      \u003cid\u003egpg.passphrase\u003c/id\u003e\n      \u003cpassphrase\u003e${env.GPG_PASSPHRASE}\u003c/passphrase\u003e\n    \u003c/server\u003e\n  \u003c/servers\u003e\n\u003c/settings\u003e\n```\n\n`settings.xml` file created for the second deploy to Apache Maven Central\n```xml\n\u003csettings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd\"\u003e\n  \u003cservers\u003e\n    \u003cserver\u003e\n      \u003cid\u003emaven\u003c/id\u003e\n      \u003cusername\u003e${env.MAVEN_USERNAME}\u003c/username\u003e\n      \u003cpassword\u003e${env.MAVEN_CENTRAL_TOKEN}\u003c/password\u003e\n    \u003c/server\u003e\n    \u003cserver\u003e\n      \u003cid\u003egpg.passphrase\u003c/id\u003e\n      \u003cpassphrase\u003e${env.MAVEN_GPG_PASSPHRASE}\u003c/passphrase\u003e\n    \u003c/server\u003e\n  \u003c/servers\u003e\n\u003c/settings\u003e\n```\n\n***NOTE: The `settings.xml` file is created in the Actions $HOME directory. If you have an existing `settings.xml` file at that location, it will be overwritten. See below for using the `settings-path` to change your `settings.xml` file location.***\n\nIf you don't want to overwrite the `settings.xml` file, you can set `overwrite-settings: false`.\n\nIf `gpg-private-key` input is provided, the private key will be written to a file in the runner's temp directory, the private key file will be imported into the GPG keychain, and then the file will be promptly removed before proceeding with the rest of the setup process. A cleanup step will remove the imported private key from the GPG keychain after the job completes regardless of the job status. This ensures that the private key is no longer accessible on self-hosted runners and cannot \"leak\" between jobs (hosted runners are always clean instances).\n\nSee the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file.\n\n## Publishing using Gradle\n```yaml\njobs:\n\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v2\n\n    - name: Set up JDK 1.8\n      uses: joschi/setup-jdk@v2\n\n    - name: Build with Gradle\n      run: gradle build\n\n    - name: Publish to GitHub Packages\n      run: gradle publish\n      env:\n        USERNAME: ${{ github.actor }}\n        PASSWORD: ${{ secrets.GITHUB_TOKEN }}\n```\n\n***NOTE: The `USERNAME` and `PASSWORD` need to correspond to the credentials environment variables used in the publishing section of your `build.gradle`.***\n\nSee the help docs on [Publishing a Package with Gradle](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-gradle-for-use-with-github-packages#example-using-gradle-groovy-for-a-single-package-in-a-repository) for more information on the `build.gradle` configuration file.\n\n## Apache Maven with a settings path\n\nWhen using an Actions self-hosted runner with multiple shared runners the default `$HOME` directory can be shared by a number runners at the same time which could overwrite existing settings file. Setting the `settings-path` variable allows you to choose a unique location for your settings file.\n\n```yaml\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v2\n    - name: Set up JDK 1.8 for Shared Runner\n      uses: joschi/setup-jdk@v2\n      with:\n        java-version: '8'\n        server-id: github # Value of the distributionManagement/repository/id field of the pom.xml\n        settings-path: ${{ github.workspace }} # location for the settings.xml file\n\n    - name: Build with Maven\n      run: mvn -B package --file pom.xml\n\n    - name: Publish to GitHub Packages Apache Maven\n      run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml\n      env:\n        GITHUB_TOKEN: ${{ github.token }}\n```\n\n# License\n\nThe scripts and documentation in this project are released under the [MIT License](LICENSE)\n\n# Contributions\n\nContributions are welcome!  See [Contributor's Guide](docs/contributors.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoschi%2Fsetup-jdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoschi%2Fsetup-jdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoschi%2Fsetup-jdk/lists"}