raydac / mvn-jlink

Maven plugin provides a way to load JDK and use its tools during project build
Apache License 2.0
43 stars 6 forks source link

[ADOPTIUM] Use Adoptium API instead of GitHub Release API #14

Closed cimnine closed 1 week ago

cimnine commented 1 week ago

The official Adoptium API can redirect to the respective binary hosted no GitHub, given the Adoptium git tag or major Java version. This would speed up the build, as the release pages don't need to be scrolled, especially in the case that the given version is invalid. It also eliminates GitHub API rate limits for the Adoptium provider.

See https://api.adoptium.net/q/swagger-ui/ for the API spec.

Examples:

$> # Common
$> OS=windows
$> ARCH=x64
$> TYPE=jre
$> IMPL=hotspot
$> HEAP=normal
$> VENDOR=eclipse

$> # Exact Version (git tag in respective GitHub repo)
$> VERSION=jdk-17.0.12+7
$> http "https://api.adoptium.net/v3/binary/version/$VERSION/$OS/$ARCH/$TYPE/$IMPL/$HEAP/$VENDOR"

HTTP/1.1 307 Temporary Redirect
Connection: keep-alive
Content-Length: 0
Date: Wed, 04 Sep 2024 09:03:21 GMT
Location: https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.12%2B7/OpenJDK17U-jre_x64_windows_hotspot_17.0.12_7.zip
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Pod-Hostname: frontend-service-6b96d79d8-bsqj2
content-encoding: identity

$> # Major Version only
$> MAJOR=17
$> http "https://api.adoptium.net/v3/binary/latest/$MAJOR/ga/$OS/$ARCH/$TYPE/$IMPL/$HEAP/$VENDOR"

HTTP/1.1 307 Temporary Redirect
Connection: keep-alive
Content-Length: 0
Date: Wed, 04 Sep 2024 09:04:01 GMT
Location: https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.12%2B7/OpenJDK17U-jre_x64_windows_hotspot_17.0.12_7.zip
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Pod-Hostname: frontend-service-6b96d79d8-l9svf
content-encoding: identity
raydac commented 1 week ago

I have added ADOPTIUM_API provider, it can be used for both scenarios

 <configuration>
   <provider>ADOPTIUM_API</provider>
   <providerConfig>
      <arch>x64</arch>
      <featureVersion>17</featureVersion>
      <heapSize>normal</heapSize>
      <imageType>jdk</imageType>
      <jvmImpl>hotspot</jvmImpl>
      <releaseType>ga</releaseType>
      <vendor>eclipse</vendor>
  </providerConfig>
</configuration>
 <configuration>
      <provider>ADOPTIUM_API</provider>
      <providerConfig>
         <arch>x64</arch>
         <releaseName>jdk-21.0.4+7</releaseName>
         <heapSize>normal</heapSize>
         <imageType>jdk</imageType>
         <jvmImpl>hotspot</jvmImpl>
         <vendor>eclipse</vendor>
         <project>jdk</project>
      </providerConfig>
 </configuration>
raydac commented 1 week ago

improved in 1.2.4