Sonarcloud - sonarscanner ant in azure pipeline doesn't reflect in the scanner

I am using azure devops as our CI tool and using azure repos as scm.

I have three branches in azure repo

main, Development and Release-Development

My regular expression in sonarcloud for long lived branch is Release-*

I created my azure below pipeline which is for PR and my Release-Development is configured to run when there is a PR is raised to merge to Release-Development branch

When I raise a PR with target as Release-Development, it trigger the pipeline and it execute the analysis. But it doesn’t come as PR analysis in sonar dashboard. It always shows as main

trigger: none
pr:
   branches:
      include:
      - "main"
      - "Release-*"
   paths:
      include:
      - '*'
      exclude:
      - documentation/*
pool:
   name: Windchill-PLM
variables:
   BuildConfiguration: Release
   ArtifactNugetName: release-1.0.zip
stages:
-  stage: build
   displayName: Clean and Build
   jobs:
   -  job: clean
      displayName: Clean
      steps:
      -  task: Ant@1
         displayName: Clean
         inputs:
            buildFile: 10.build.xml
            targets: clean
            javaHomeOption: Path
            jdkUserInputDirectory: X:\Ptc\Windchill_11.2\Java
# ----------------
   -  job: build
      displayName: build
      dependsOn: clean
      steps:
      -  checkout: none
      -  task: Ant@1
         displayName: Build Resource Bundle
         inputs:
            buildFile: 10.build.xml
            targets: build.wtCustom
            javaHomeOption: Path
            jdkUserInputDirectory: X:\Ptc\Windchill_11.2\Java
      -  task: Ant@1
         displayName: compile source and test files
         inputs:
            buildFile: 10.build.xml
            targets: build.src
            javaHomeOption: Path
            jdkUserInputDirectory: X:\Ptc\Windchill_11.2\Java
   -  job: qualitycheck
      displayName: Sonar Quality Check
      dependsOn: build
      steps:
      -  checkout: none
      -  task: Ant@1
         displayName: sonar Quality Analysis of source files
         inputs:
            buildFile: 10.build.xml
            targets: sonar
            javaHomeOption: Path
            jdkUserInputDirectory: X:\Development\pkgna\jdk-11.0.12

The same is happening for long living branch where the branch level it is always main

The have a copy of the same pipe line where trigger it for main and Release-* and the pr: is removed

Any help is is appreciated

Hey there.

Boy do we tend to forget about Ant… :smiley:

Things should snap into place if you add the Prepare Analysis Configuration task to your pipeline and select “Integrate with Maven or Gradle” (“Other”) as the scanner mode.