Azure Pipelines / Maven Issue

Hi, I am using Azure Pipelines with the Maven3 task and setting code coverage and sonarcloud analysis. Analysis and code coverage reports are bing uploaded to SonarCloud BUT maven is actually being run twice and increasing our build times more than we would like.

Basically maven runs our package, verify or deploy task and as soon as it completes another maven command is run with the jacoco agent being present and runs a second clean and verify. We have confirmed that this happens when code coverage is enabled in the maven task and the second build is not triggered when code coverage is not enabled.

We had thought that we could add the jacoco agent to the main maven task however when we do this NO COVERAGE is reported to SonarCloud.

Is this a bug? Is anyone aware of a workaround?

Thanks, Andy.

1 Like

Hi @andye2004.

Could you share your azure-pipelines.yaml (or part of it)?

That’s strange, please look at this azure-pipelines.yaml. It seems to be working correctly, see the Azure Pipelines logs and the project on SonarCloud.

Hi @felipebz, thanks for responding.

Looking at the pipeline you linked we might be missing the report goal. I can’t see it until tomorrow but will check and report back then.

Thanks, Andy.

Hi @felipebz, that works for me. Thanks for posting.