aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2025-07-21 11:33:27 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2025-07-21 14:55:05 +0200
commit8667740fa4bba168d4f4f90aa5412456a6ea619e (patch)
tree0cc648cb2de84d942d1ae898209ae949a9a44798
parent9c91f2c51378deb18205c4fb0ab98f91bfcf5b5d (diff)
downloadsonar-scanner-cli-jh/update_jres_claude.tar.gz
sonar-scanner-cli-jh/update_jres_claude.zip
Update JREs to 17.0.15+6jh/update_jres_claude
-rw-r--r--.claude/update-jres.md46
-rw-r--r--CLAUDE.md20
-rw-r--r--pom.xml30
3 files changed, 81 insertions, 15 deletions
diff --git a/.claude/update-jres.md b/.claude/update-jres.md
new file mode 100644
index 0000000..a07e520
--- /dev/null
+++ b/.claude/update-jres.md
@@ -0,0 +1,46 @@
+# Update JREs Command
+
+Updates all bundled JREs in the sonar-scanner-cli project to the latest available JRE 17 version for each architecture by automatically querying the Adoptium API.
+
+## Arguments
+- `latest` (default) - automatically finds the latest JRE 17 version for each architecture
+- `<version>` - specify exact version like `17.0.15+6`
+
+## Steps performed:
+1. **Fetch release metadata**: Query Adoptium/Temurin API to find the releases details
+2. **Update version properties**: Update JRE root directory name in the pom.xml `<properties>` section for each architecture
+3. **Update download URLs**: Update download URLs and SHA256 hashes for all platform profiles
+4. **Validate changes**: Ensure all Maven profiles are properly updated, then run `mvn clean verify -P<list of all architecture-specific profile ids>` to be sure there are no errors
+
+## Platforms supported:
+- Linux x64: `OpenJDK17U-jre_x64_linux_hotspot_{version}.tar.gz`
+- Linux aarch64: `OpenJDK17U-jre_aarch64_linux_hotspot_{version}.tar.gz`
+- macOS x64: `OpenJDK17U-jre_x64_mac_hotspot_{version}.tar.gz`
+- macOS aarch64: `OpenJDK17U-jre_aarch64_mac_hotspot_{version}.tar.gz`
+- Windows x64: `OpenJDK17U-jre_x64_windows_hotspot_{version}.zip`
+
+## Usage:
+```
+/update-jres # Uses latest version (default)
+/update-jres latest # Same as above
+/update-jres 17.0.15+6 # Uses specific version
+```
+
+## Implementation Details:
+
+Don't use the GitHub API, as there is an Adoptium API:
+
+When using "latest" (default behavior), the command will:
+
+1. **Query the latest release metadata**: Use the Adoptium API: `curl -X 'GET' 'https://api.adoptium.net/v3/assets/latest/17/hotspot?image_type=jre&vendor=eclipse' -H 'accept: application/json'`
+2. **Handle missing architectures**: If an architecture isn't found in the latest release, it might be that the release process is in progress. In this case suggest staying on the previous version.
+3. **Read metadata from the JSON**: For each architecture/version combination:
+ - Read download URL from the JSON metadata (`binary.package.link`)
+ - Read SHA256 hash from from the JSON metadata (`binary.package.checksum`)
+
+When using a specific version, the command will:
+
+1. **Query the release metadata**: Use the Adoptium API: `curl -X 'GET' 'https://api.adoptium.net/v3/assets/version/<version URL encoded>?image_type=jre&page=0&page_size=10&project=jdk&release_type=ga&semver=false&sort_method=DEFAULT&sort_order=DESC&vendor=eclipse' -H 'accept: application/json'`
+2. **Read metadata from the JSON**: For each architecture/version combination:
+ - Read download URL from the JSON metadata (`binaries.package.link`)
+ - Read SHA256 hash from from the JSON metadata (`binaries.package.checksum`)
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 0000000..667f03a
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,20 @@
+# Claude Commands for SonarScanner CLI
+
+## Update JREs
+
+Help updating all bundled JREs to the latest available JRE 17 version, or to a specific version, by automatically querying the Adoptium API.
+
+**Command:** `/update-jres`
+
+**Usage:**
+```
+/update-jres # Uses latest version (default)
+/update-jres latest # Same as above
+/update-jres 17.0.15+6 # Uses specific version
+```
+
+**What it does:**
+1. **Get JREs metadata**: Queries Adoptium API to get JREs metadata
+2. **Updates version properties**: Updates architecture-specific dirname properties in pom.xml
+3. **Updates download URLs**: Updates platform-specific download URLs
+4. **Updates SHA256 hashes**: Updates SHA256 hashes for each platform
diff --git a/pom.xml b/pom.xml
index 88fce6a..83aaa98 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,11 +55,11 @@
<!-- configuration for assembly of distributions -->
<unpack.dir>${project.build.directory}/unpack</unpack.dir>
<scanner.jar>${project.build.finalName}.jar</scanner.jar>
- <jre.dirname.linux.aarch64>jdk-17.0.13+11-jre</jre.dirname.linux.aarch64>
- <jre.dirname.linux.x64>jdk-17.0.13+11-jre</jre.dirname.linux.x64>
- <jre.dirname.macosx.aarch64>jdk-17.0.13+11-jre/Contents/Home</jre.dirname.macosx.aarch64>
- <jre.dirname.macosx.x64>jdk-17.0.13+11-jre/Contents/Home</jre.dirname.macosx.x64>
- <jre.dirname.windows>jdk-17.0.13+11-jre</jre.dirname.windows>
+ <jre.dirname.linux.aarch64>jdk-17.0.15+6-jre</jre.dirname.linux.aarch64>
+ <jre.dirname.linux.x64>jdk-17.0.15+6-jre</jre.dirname.linux.x64>
+ <jre.dirname.macosx.aarch64>jdk-17.0.15+6-jre/Contents/Home</jre.dirname.macosx.aarch64>
+ <jre.dirname.macosx.x64>jdk-17.0.15+6-jre/Contents/Home</jre.dirname.macosx.x64>
+ <jre.dirname.windows>jdk-17.0.15+6-jre</jre.dirname.windows>
<!-- Release: enable publication to Bintray -->
<artifactsToPublish>${project.groupId}:${project.artifactId}:zip,${project.groupId}:${project.artifactId}:zip:linux-x64,${project.groupId}:${project.artifactId}:zip:linux-aarch64,${project.groupId}:${project.artifactId}:zip:windows-x64,${project.groupId}:${project.artifactId}:zip:macosx-x64,${project.groupId}:${project.artifactId}:zip:macosx-aarch64,${project.groupId}:${project.artifactId}:json:cyclonedx</artifactsToPublish>
@@ -291,10 +291,10 @@
<goal>wget</goal>
</goals>
<configuration>
- <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_x64_linux_hotspot_17.0.13_11.tar.gz</url>
+ <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_x64_linux_hotspot_17.0.15_6.tar.gz</url>
<unpack>true</unpack>
<outputDirectory>${unpack.dir}/linux-x64</outputDirectory>
- <sha256>4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff</sha256>
+ <sha256>aaed740c38ff1e87a4b920f9deb165d419d9fdf23f423740d2ecb280eeab9647</sha256>
</configuration>
</execution>
</executions>
@@ -364,10 +364,10 @@
<goal>wget</goal>
</goals>
<configuration>
- <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.13_11.tar.gz</url>
+ <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_aarch64_linux_hotspot_17.0.15_6.tar.gz</url>
<unpack>true</unpack>
<outputDirectory>${unpack.dir}/linux-aarch64</outputDirectory>
- <sha256>97c4fb748eaa1292fb2f28fec90a3eba23e35974ef67f8b3aa304ad4db2ba162</sha256>
+ <sha256>c89467f543bd434b71f3b748adeeeb1b2692f90242824b78205be1ae72ba385f</sha256>
</configuration>
</execution>
</executions>
@@ -437,10 +437,10 @@
<goal>wget</goal>
</goals>
<configuration>
- <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_x64_windows_hotspot_17.0.13_11.zip</url>
+ <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_x64_windows_hotspot_17.0.15_6.zip</url>
<unpack>true</unpack>
<outputDirectory>${unpack.dir}/windows-x64</outputDirectory>
- <sha256>11a61a94d383e755b08b4e5890a13d148bc9f95b7149cbbeec62efb8c75a4a67</sha256>
+ <sha256>4380136495b1aebf10593a94c98babd632155e5ace3fa5b1a1a3b79d6fbe2e99</sha256>
</configuration>
</execution>
</executions>
@@ -510,10 +510,10 @@
<goal>wget</goal>
</goals>
<configuration>
- <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_x64_mac_hotspot_17.0.13_11.tar.gz</url>
+ <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_x64_mac_hotspot_17.0.15_6.tar.gz</url>
<unpack>true</unpack>
<outputDirectory>${unpack.dir}/macosx-x64</outputDirectory>
- <sha256>bf9faf4540001a251e6bfb52b99c7ec5b1f36d3ebe94e104f61a30f173ba8c78</sha256>
+ <sha256>38f7bb3faaa3aec90290e6dd912a050cc895ee2aa8fb9d8ea6aac86822bb108b</sha256>
</configuration>
</execution>
</executions>
@@ -583,10 +583,10 @@
<goal>wget</goal>
</goals>
<configuration>
- <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.13_11.tar.gz</url>
+ <url>https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.15%2B6/OpenJDK17U-jre_aarch64_mac_hotspot_17.0.15_6.tar.gz</url>
<unpack>true</unpack>
<outputDirectory>${unpack.dir}/macosx-aarch64</outputDirectory>
- <sha256>a886b8f2a50eca2e59b45ea59f5a2e8e9d27ff5b5b3b069443a70cda7f27c907</sha256>
+ <sha256>2eb9548fbed1031355ca11a35b5a297e9872edd1dafacb40294f0c1a6677bbfb</sha256>
</configuration>
</execution>
</executions>