Copilot commented on code in PR #467:
URL: 
https://github.com/apache/commons-fileupload/pull/467#discussion_r2616828334


##########
.github/workflows/maven.yml:
##########
@@ -29,28 +29,50 @@ jobs:
 
     runs-on: ubuntu-latest
     continue-on-error: ${{ matrix.experimental }}
+
     strategy:
       matrix:
         java: [ 11, 17, 21, 25 ]
         experimental: [false]
         include:
           - java: 26-ea
             experimental: true
-        
+
     steps:
-    - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
-      with:
-        persist-credentials: false
-    - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
-      with:
-        path: ~/.m2/repository
-        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-        restore-keys: |
-          ${{ runner.os }}-maven-
-    - name: Set up JDK ${{ matrix.java }}
-      uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # 
v5.1.0
-      with:
-        distribution: 'temurin'
-        java-version: ${{ matrix.java }}
-    - name: Build with Maven
-      run: mvn --errors --show-version --batch-mode --no-transfer-progress
+      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 
v6.0.1
+        with:
+          persist-credentials: false
+
+      - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+
+      - name: Set up JDK ${{ matrix.java }}
+        uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # 
v5.1.0
+        with:
+          distribution: 'temurin'
+          java-version: ${{ matrix.java }}
+
+      # Normal build for ALL Java versions
+      - name: Build with Maven
+        if: matrix.java != '21'
+        run: mvn --errors --show-version --batch-mode --no-transfer-progress 
verify
+
+      # SonarCloud analysis ONLY on Java 21
+      - name: Build and analyze with SonarCloud (Java 21)
+        if: matrix.java == '21'
+        env:
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+        run: |
+          mvn --errors \
+              --show-version \
+              --batch-mode \
+              --no-transfer-progress \
+              verify sonar:sonar \
+              -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} \
+              -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} \
+              -Dsonar.host.url=https://sonarcloud.io

Review Comment:
   The multi-line command is missing a line continuation backslash at the end 
of line 77. This will cause a syntax error in the shell script execution. The 
line with "-Dsonar.host.url=https://sonarcloud.io"; should end with a backslash 
to continue to the next line with "-Dsonar.login".
   ```suggestion
                 -Dsonar.host.url=https://sonarcloud.io \
   ```



##########
.github/workflows/maven.yml:
##########
@@ -29,28 +29,50 @@ jobs:
 
     runs-on: ubuntu-latest
     continue-on-error: ${{ matrix.experimental }}
+
     strategy:
       matrix:
         java: [ 11, 17, 21, 25 ]
         experimental: [false]
         include:
           - java: 26-ea
             experimental: true
-        
+
     steps:
-    - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
-      with:
-        persist-credentials: false
-    - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
-      with:
-        path: ~/.m2/repository
-        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
-        restore-keys: |
-          ${{ runner.os }}-maven-
-    - name: Set up JDK ${{ matrix.java }}
-      uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # 
v5.1.0
-      with:
-        distribution: 'temurin'
-        java-version: ${{ matrix.java }}
-    - name: Build with Maven
-      run: mvn --errors --show-version --batch-mode --no-transfer-progress
+      - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 
v6.0.1
+        with:
+          persist-credentials: false
+
+      - uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+
+      - name: Set up JDK ${{ matrix.java }}
+        uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # 
v5.1.0
+        with:
+          distribution: 'temurin'
+          java-version: ${{ matrix.java }}
+
+      # Normal build for ALL Java versions
+      - name: Build with Maven
+        if: matrix.java != '21'
+        run: mvn --errors --show-version --batch-mode --no-transfer-progress 
verify
+
+      # SonarCloud analysis ONLY on Java 21
+      - name: Build and analyze with SonarCloud (Java 21)
+        if: matrix.java == '21'
+        env:
+          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+        run: |
+          mvn --errors \
+              --show-version \
+              --batch-mode \
+              --no-transfer-progress \
+              verify sonar:sonar \
+              -Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }} \
+              -Dsonar.organization=${{ secrets.SONAR_ORGANIZATION }} \
+              -Dsonar.host.url=https://sonarcloud.io
+              -Dsonar.login=${{ secrets.SONAR_TOKEN }}

Review Comment:
   The parameter "-Dsonar.login" is deprecated in favor of "-Dsonar.token". 
Since SONAR_TOKEN is already set as an environment variable on line 68, you can 
either use "-Dsonar.token" instead of "-Dsonar.login", or remove this line 
entirely as the SONAR_TOKEN environment variable should be automatically picked 
up by the SonarCloud scanner.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to