Not able to analyze the maven project

`[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project TDDFramework: Project not found. Please check the ‘sonar.projectKey’ and ‘sonar.organization’ properties, the ‘SONAR_TOKEN’ environment variable, or contact the project administrator.

Any response would be greatly appreciated.

Hi,

The error is IMO pretty clear.

Did you set sonar.organization? Did you set sonar.projectKey? Does it correspond to the key of a project that exists on SonarCloud? If ‘yes’ to all these things, then it’s time to double-check your SONAR_TOKEN env var.

 
HTH,
Ann

I re-imported the project, set the organization key, project key and the environment variables correctly. Its working fine now. But then its passing the pipeline in the Bitbucket. But still shows as build failure and produces this error in bitbucket.

Also, the Project is working on Java 11.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project TDDFramework: There are test failures.

Here’s the pipelines:

image: maven:3-openjdk-11 # Or newer

clone:
  depth: full

definitions:
  caches:
    sonar: ~/.sonar/cache
  steps:
    - step: &build-test-sonarcloud
        name: Build, test and analyze on SonarCloud
        caches:
          - maven
          - sonar
        script:
          - echo 'SonarCloud Step'
          - mvn clean 
          - mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
          - mvn clean verify -P sonar -Dsonar.login=$SONAR_TOKEN

        artifacts:
          - target/**

pipelines:
  branches:
    master:
      - step: *build-test-sonarcloud
  pull-requests:
    '**':
      - step: *build-test-sonarcloud

Hi,

We don’t run your tests for you. This error is happening before you ever get to analysis, and it’s not a process failure but a failure in your project. You need to look into why your tests are failing.

 
HTH,
Ann

It finally worked. Thank you very much.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.