Search code examples
mavenazure-devopssonarqube

Prepare Analysis Task Failing with ##[error][SQ] API GET '/api/server/version' failed only for Maven Integration in Azure Devops


Im stuck with this error for a long time now in Prepare Analysis Task in Azure DevOps .

Im using a proxy task defined in Inline powershell before this task where i defined -Dhttps.proxyHost and -Dhttps.proxyPort along with Dhttp.proxyHost and -Dhttp.proxyPort which works fine with Msbuild, But unfortunately i recieve this below error when i select Integrate with Maven.

Im confused as the proxy points to same sonar instance for MS build and Maven but Msbuild succeeds while Maven Fails

##[error][SQ] API GET '/api/server/version' failed, error was: {"code":"ENOTFOUND","errno":"ENOTFOUND","syscall":"getaddrinfo","hostname"


Solution

  • The solution is to define the proxy in Variable groups and link that to pipeline. This way Prepare Analysis Task works perfectly to achieve connection to sonarqube instance through a proxy when we use "Integrate With Maven or Gradle option".

    For MSBuid and Standalone Scanner options we can use Inline Powershell to define the Sonar_Scanner_opts to use the proxy connection to sonarqube instance