SonarScanner running inside the docker container cannot access source code

Viewed 889

I'm trying to scan the source code of some project with SonarQube and SonarScanner running locally on Docker, OS: Windows.

By providing the next command in the terminal I'm trying to run container with SonarScanner which should scan the code in my current directory (SonarQube instance is running in the background):

docker run \
    --rm \
    --network=host \
    -e SONAR_HOST_URL="http://127.0.0.1:9000/" \
    -e SONAR_LOGIN="...some token..." \
    -v $PWD:/usr/src sonarsource/sonar-scanner-cli \
    -Dsonar.projectKey=some-project-name

After that I get 'EXECUTION SUCCESS' message, but SonarQube shows "No code files were found for analysis" in the "Code" tab (statistics are empty too).

I have tried to add -Dsonar.sources=some_subdirectory_which_exists_in_the_current_directory parameter, which results in 'EXECUTION FAILURE' message with "the folder does not exist in base directory" message. So I think that the container just doesn't have access to project files or for some reason it doesn't copy them.

0 Answers
Related