Skip to content

Commit 25d2c90

Browse files
authored
SCANCLI-189 Update JREs to 17.0.15+6
1 parent 8fe5b18 commit 25d2c90

File tree

7 files changed

+218
-25
lines changed

7 files changed

+218
-25
lines changed

.claude/update-jres.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Update JREs Command
2+
3+
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.
4+
5+
## Arguments
6+
- `latest` (default) - automatically finds the latest JRE 17 version for each architecture
7+
- `<version>` - specify exact version like `17.0.15+6`
8+
9+
## Steps performed:
10+
1. **Fetch release metadata**: Query Adoptium/Temurin API to find the releases details
11+
2. **Update version properties**: Update JRE root directory name in the pom.xml `<properties>` section for each architecture
12+
3. **Update download URLs**: Update download URLs and SHA256 hashes for all platform profiles
13+
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
14+
15+
## Platforms supported:
16+
- Linux x64: `OpenJDK17U-jre_x64_linux_hotspot_{version}.tar.gz`
17+
- Linux aarch64: `OpenJDK17U-jre_aarch64_linux_hotspot_{version}.tar.gz`
18+
- macOS x64: `OpenJDK17U-jre_x64_mac_hotspot_{version}.tar.gz`
19+
- macOS aarch64: `OpenJDK17U-jre_aarch64_mac_hotspot_{version}.tar.gz`
20+
- Windows x64: `OpenJDK17U-jre_x64_windows_hotspot_{version}.zip`
21+
22+
## Usage:
23+
```
24+
/update-jres # Uses latest version (default)
25+
/update-jres latest # Same as above
26+
/update-jres 17.0.15+6 # Uses specific version
27+
```
28+
29+
## Implementation Details:
30+
31+
Don't use the GitHub API, as there is an Adoptium API:
32+
33+
When using "latest" (default behavior), the command will:
34+
35+
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'`
36+
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.
37+
3. **Read metadata from the JSON**: For each architecture/version combination:
38+
- Read download URL from the JSON metadata (`binary.package.link`)
39+
- Read SHA256 hash from from the JSON metadata (`binary.package.checksum`)
40+
41+
When using a specific version, the command will:
42+
43+
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'`
44+
2. **Read metadata from the JSON**: For each architecture/version combination:
45+
- Read download URL from the JSON metadata (`binaries.package.link`)
46+
- Read SHA256 hash from from the JSON metadata (`binaries.package.checksum`)

CLAUDE.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Claude Commands for SonarScanner CLI
2+
3+
## Update JREs
4+
5+
Help updating all bundled JREs to the latest available JRE 17 version, or to a specific version, by automatically querying the Adoptium API.
6+
7+
**Command:** `/update-jres`
8+
9+
**Usage:**
10+
```
11+
/update-jres # Uses latest version (default)
12+
/update-jres latest # Same as above
13+
/update-jres 17.0.15+6 # Uses specific version
14+
```
15+
16+
**What it does:**
17+
1. **Get JREs metadata**: Queries Adoptium API to get JREs metadata
18+
2. **Updates version properties**: Updates architecture-specific dirname properties in pom.xml
19+
3. **Updates download URLs**: Updates platform-specific download URLs
20+
4. **Updates SHA256 hashes**: Updates SHA256 hashes for each platform

pom.xml

Lines changed: 140 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@
5555
<!-- configuration for assembly of distributions -->
5656
<unpack.dir>${project.build.directory}/unpack</unpack.dir>
5757
<scanner.jar>${project.build.finalName}.jar</scanner.jar>
58-
<jre.dirname.linux>jdk-17.0.13+11-jre</jre.dirname.linux>
59-
<jre.dirname.windows>jdk-17.0.13+11-jre</jre.dirname.windows>
60-
<jre.dirname.macosx>jdk-17.0.13+11-jre/Contents/Home</jre.dirname.macosx>
58+
<jre.dirname.linux.aarch64>jdk-17.0.15+6-jre</jre.dirname.linux.aarch64>
59+
<jre.dirname.linux.x64>jdk-17.0.15+6-jre</jre.dirname.linux.x64>
60+
<jre.dirname.macosx.aarch64>jdk-17.0.15+6-jre/Contents/Home</jre.dirname.macosx.aarch64>
61+
<jre.dirname.macosx.x64>jdk-17.0.15+6-jre/Contents/Home</jre.dirname.macosx.x64>
62+
<jre.dirname.windows>jdk-17.0.15+6-jre</jre.dirname.windows>
6163

6264
<!-- Release: enable publication to Bintray -->
6365
<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>
@@ -289,10 +291,10 @@
289291
<goal>wget</goal>
290292
</goals>
291293
<configuration>
292-
<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>
294+
<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>
293295
<unpack>true</unpack>
294296
<outputDirectory>${unpack.dir}/linux-x64</outputDirectory>
295-
<sha256>4086cc7cb2d9e7810141f255063caad10a8a018db5e6b47fa5394c506ab65bff</sha256>
297+
<sha256>aaed740c38ff1e87a4b920f9deb165d419d9fdf23f423740d2ecb280eeab9647</sha256>
296298
</configuration>
297299
</execution>
298300
</executions>
@@ -319,6 +321,31 @@
319321
</execution>
320322
</executions>
321323
</plugin>
324+
<plugin>
325+
<groupId>org.apache.maven.plugins</groupId>
326+
<artifactId>maven-enforcer-plugin</artifactId>
327+
<executions>
328+
<execution>
329+
<id>enforce-linux-x64-distribution-size</id>
330+
<goals>
331+
<goal>enforce</goal>
332+
</goals>
333+
<phase>verify</phase>
334+
<configuration>
335+
<rules>
336+
<requireFilesSize>
337+
<!-- Should be big enough to confirm the JRE was bundled -->
338+
<minsize>50000000</minsize>
339+
<maxsize>60000000</maxsize>
340+
<files>
341+
<file>${project.build.directory}/sonar-scanner-${project.version}-linux-x64.zip</file>
342+
</files>
343+
</requireFilesSize>
344+
</rules>
345+
</configuration>
346+
</execution>
347+
</executions>
348+
</plugin>
322349
</plugins>
323350
</build>
324351
</profile>
@@ -337,10 +364,10 @@
337364
<goal>wget</goal>
338365
</goals>
339366
<configuration>
340-
<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>
367+
<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>
341368
<unpack>true</unpack>
342369
<outputDirectory>${unpack.dir}/linux-aarch64</outputDirectory>
343-
<sha256>97c4fb748eaa1292fb2f28fec90a3eba23e35974ef67f8b3aa304ad4db2ba162</sha256>
370+
<sha256>c89467f543bd434b71f3b748adeeeb1b2692f90242824b78205be1ae72ba385f</sha256>
344371
</configuration>
345372
</execution>
346373
</executions>
@@ -367,6 +394,31 @@
367394
</execution>
368395
</executions>
369396
</plugin>
397+
<plugin>
398+
<groupId>org.apache.maven.plugins</groupId>
399+
<artifactId>maven-enforcer-plugin</artifactId>
400+
<executions>
401+
<execution>
402+
<id>enforce-linux-aarch64-distribution-size</id>
403+
<goals>
404+
<goal>enforce</goal>
405+
</goals>
406+
<phase>verify</phase>
407+
<configuration>
408+
<rules>
409+
<requireFilesSize>
410+
<!-- Should be big enough to confirm the JRE was bundled -->
411+
<minsize>50000000</minsize>
412+
<maxsize>60000000</maxsize>
413+
<files>
414+
<file>${project.build.directory}/sonar-scanner-${project.version}-linux-aarch64.zip</file>
415+
</files>
416+
</requireFilesSize>
417+
</rules>
418+
</configuration>
419+
</execution>
420+
</executions>
421+
</plugin>
370422
</plugins>
371423
</build>
372424
</profile>
@@ -385,10 +437,10 @@
385437
<goal>wget</goal>
386438
</goals>
387439
<configuration>
388-
<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>
440+
<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>
389441
<unpack>true</unpack>
390442
<outputDirectory>${unpack.dir}/windows-x64</outputDirectory>
391-
<sha256>11a61a94d383e755b08b4e5890a13d148bc9f95b7149cbbeec62efb8c75a4a67</sha256>
443+
<sha256>4380136495b1aebf10593a94c98babd632155e5ace3fa5b1a1a3b79d6fbe2e99</sha256>
392444
</configuration>
393445
</execution>
394446
</executions>
@@ -415,6 +467,31 @@
415467
</execution>
416468
</executions>
417469
</plugin>
470+
<plugin>
471+
<groupId>org.apache.maven.plugins</groupId>
472+
<artifactId>maven-enforcer-plugin</artifactId>
473+
<executions>
474+
<execution>
475+
<id>enforce-windows-x64-distribution-size</id>
476+
<goals>
477+
<goal>enforce</goal>
478+
</goals>
479+
<phase>verify</phase>
480+
<configuration>
481+
<rules>
482+
<requireFilesSize>
483+
<!-- Should be big enough to confirm the JRE was bundled -->
484+
<minsize>50000000</minsize>
485+
<maxsize>60000000</maxsize>
486+
<files>
487+
<file>${project.build.directory}/sonar-scanner-${project.version}-windows-x64.zip</file>
488+
</files>
489+
</requireFilesSize>
490+
</rules>
491+
</configuration>
492+
</execution>
493+
</executions>
494+
</plugin>
418495
</plugins>
419496
</build>
420497
</profile>
@@ -433,10 +510,10 @@
433510
<goal>wget</goal>
434511
</goals>
435512
<configuration>
436-
<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>
513+
<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>
437514
<unpack>true</unpack>
438515
<outputDirectory>${unpack.dir}/macosx-x64</outputDirectory>
439-
<sha256>bf9faf4540001a251e6bfb52b99c7ec5b1f36d3ebe94e104f61a30f173ba8c78</sha256>
516+
<sha256>38f7bb3faaa3aec90290e6dd912a050cc895ee2aa8fb9d8ea6aac86822bb108b</sha256>
440517
</configuration>
441518
</execution>
442519
</executions>
@@ -463,6 +540,31 @@
463540
</execution>
464541
</executions>
465542
</plugin>
543+
<plugin>
544+
<groupId>org.apache.maven.plugins</groupId>
545+
<artifactId>maven-enforcer-plugin</artifactId>
546+
<executions>
547+
<execution>
548+
<id>enforce-macosx-x64-distribution-size</id>
549+
<goals>
550+
<goal>enforce</goal>
551+
</goals>
552+
<phase>verify</phase>
553+
<configuration>
554+
<rules>
555+
<requireFilesSize>
556+
<!-- Should be big enough to confirm the JRE was bundled -->
557+
<minsize>49000000</minsize>
558+
<maxsize>60000000</maxsize>
559+
<files>
560+
<file>${project.build.directory}/sonar-scanner-${project.version}-macosx-x64.zip</file>
561+
</files>
562+
</requireFilesSize>
563+
</rules>
564+
</configuration>
565+
</execution>
566+
</executions>
567+
</plugin>
466568
</plugins>
467569
</build>
468570
</profile>
@@ -481,10 +583,10 @@
481583
<goal>wget</goal>
482584
</goals>
483585
<configuration>
484-
<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>
586+
<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>
485587
<unpack>true</unpack>
486588
<outputDirectory>${unpack.dir}/macosx-aarch64</outputDirectory>
487-
<sha256>a886b8f2a50eca2e59b45ea59f5a2e8e9d27ff5b5b3b069443a70cda7f27c907</sha256>
589+
<sha256>2eb9548fbed1031355ca11a35b5a297e9872edd1dafacb40294f0c1a6677bbfb</sha256>
488590
</configuration>
489591
</execution>
490592
</executions>
@@ -511,6 +613,31 @@
511613
</execution>
512614
</executions>
513615
</plugin>
616+
<plugin>
617+
<groupId>org.apache.maven.plugins</groupId>
618+
<artifactId>maven-enforcer-plugin</artifactId>
619+
<executions>
620+
<execution>
621+
<id>enforce-macosx-aarch64-distribution-size</id>
622+
<goals>
623+
<goal>enforce</goal>
624+
</goals>
625+
<phase>verify</phase>
626+
<configuration>
627+
<rules>
628+
<requireFilesSize>
629+
<!-- Should be big enough to confirm the JRE was bundled -->
630+
<minsize>49000000</minsize>
631+
<maxsize>60000000</maxsize>
632+
<files>
633+
<file>${project.build.directory}/sonar-scanner-${project.version}-macosx-aarch64.zip</file>
634+
</files>
635+
</requireFilesSize>
636+
</rules>
637+
</configuration>
638+
</execution>
639+
</executions>
640+
</plugin>
514641
</plugins>
515642
</build>
516643
</profile>

src/main/assembly/dist-linux-aarch64.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<!-- jre basic, except bin/ -->
1111
<fileSet>
12-
<directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux}</directory>
12+
<directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux.aarch64}</directory>
1313
<outputDirectory>jre</outputDirectory>
1414
<excludes>
1515
<exclude>bin/**</exclude>
@@ -22,7 +22,7 @@
2222

2323
<!-- jre bin/java -->
2424
<fileSet>
25-
<directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux}/bin</directory>
25+
<directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux.aarch64}/bin</directory>
2626
<outputDirectory>jre/bin</outputDirectory>
2727
<includes>
2828
<include>java</include>
@@ -32,7 +32,7 @@
3232

3333
<!-- jre lib executable files -->
3434
<fileSet>
35-
<directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux}/lib</directory>
35+
<directory>${unpack.dir}/linux-aarch64/${jre.dirname.linux.aarch64}/lib</directory>
3636
<outputDirectory>jre/lib</outputDirectory>
3737
<includes>
3838
<include>jspawnhelper</include>

src/main/assembly/dist-linux-x64.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<!-- jre basic, except bin/ -->
1111
<fileSet>
12-
<directory>${unpack.dir}/linux-x64/${jre.dirname.linux}</directory>
12+
<directory>${unpack.dir}/linux-x64/${jre.dirname.linux.x64}</directory>
1313
<outputDirectory>jre</outputDirectory>
1414
<excludes>
1515
<exclude>bin/**</exclude>
@@ -22,7 +22,7 @@
2222

2323
<!-- jre bin/java -->
2424
<fileSet>
25-
<directory>${unpack.dir}/linux-x64/${jre.dirname.linux}/bin</directory>
25+
<directory>${unpack.dir}/linux-x64/${jre.dirname.linux.x64}/bin</directory>
2626
<outputDirectory>jre/bin</outputDirectory>
2727
<includes>
2828
<include>java</include>
@@ -32,7 +32,7 @@
3232

3333
<!-- jre lib executable files -->
3434
<fileSet>
35-
<directory>${unpack.dir}/linux-x64/${jre.dirname.linux}/lib</directory>
35+
<directory>${unpack.dir}/linux-x64/${jre.dirname.linux.x64}/lib</directory>
3636
<outputDirectory>jre/lib</outputDirectory>
3737
<includes>
3838
<include>jspawnhelper</include>

src/main/assembly/dist-macosx-aarch64.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<!-- jre basic, except bin/ and misc -->
1111
<fileSet>
12-
<directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx}</directory>
12+
<directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx.aarch64}</directory>
1313
<outputDirectory>jre</outputDirectory>
1414
<excludes>
1515
<exclude>bin/**</exclude>
@@ -20,7 +20,7 @@
2020

2121
<!-- jre bin/java -->
2222
<fileSet>
23-
<directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx}/bin</directory>
23+
<directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx.aarch64}/bin</directory>
2424
<outputDirectory>jre/bin</outputDirectory>
2525
<includes>
2626
<include>java</include>
@@ -30,7 +30,7 @@
3030

3131
<!-- jre lib executable files -->
3232
<fileSet>
33-
<directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx}/lib</directory>
33+
<directory>${unpack.dir}/macosx-aarch64/${jre.dirname.macosx.aarch64}/lib</directory>
3434
<outputDirectory>jre/lib</outputDirectory>
3535
<includes>
3636
<include>jspawnhelper</include>

0 commit comments

Comments
 (0)