【问题标题】:How to use Amazon Corretto JDK with Github Actions?如何将 Amazon Corretto JDK 与 Github Actions 结合使用?
【发布时间】:2021-05-11 00:19:05
【问题描述】:

我有一个使用 Amazon Corretto 11 的 Github Java 项目。

但我无法编写 Github 操作,以便工作流在每次拉取请求时构建项目。

例如,如果使用 OpenJDK,它会如下所示

# 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

如何使用 Corretto 代替 OpenJDK?是否有 Github 标准操作可以做到这一点?还是其他方式?

【问题讨论】:

    标签: github-actions corretto


    【解决方案1】:

    如果您想使用该操作,您可能需要向该操作提交 PR 以将 Coretto 添加为受支持的发行版。

    我很好奇为什么这很重要?您应该能够使用任何 Java 发行版进行构建。您认为有什么理由需要使用 Correto 进行构建吗?

    【讨论】:

    • 摘自亚马逊的 corretto 发布博客:We downstream fixes made in OpenJDK, add enhancements based on our own experience and needs, and then produce Corretto builds. In case any upstreaming efforts for such patches is not successful, delayed, or not appropriate for OpenJDK project, we will provide them to our customers for as long as they add value. If an issue is solved a different way in OpenJDK, we will move to that solution as soon as it is safe to do so. 这意味着两者之间会有差异(尽管很小)。如果我的理解有误,请纠正我。
    • 在同一行:您是否建议这两者之间的差异只会影响运行时,而代码编译和构建不会受到影响?
    • 我也使用过 Corretto,但我通常希望编译后的 Java 代码的输出是相同的,无论您使用哪个版本的 OpenJDK 构建。我猜理论上他们可以下游编译器修复,但这似乎不太可能,也不值得关注。
    猜你喜欢
    • 2021-09-15
    • 1970-01-01
    • 2019-12-24
    • 1970-01-01
    • 1970-01-01
    • 2016-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多