1

I have a Spring Boot project repository on Github with Travis CI integrated. Currently Travis CI is configured to build the project for commits and Pull requests, which works fine.

Next, I want to send a Jacoco report to SonarCloud. I have followed the wiki on Travis but when I look at SoundCloud project nothing is shown. Following is my configuration:

  1. Authentication token for SonarCloud account: I have generated it on SonarCloud and set it in Travis -> Environment Variables -> SONAR_TOKEN.

  2. .travis.yml

    script: 
      - mvn install -P test
      - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent org.jacoco:jacoco-maven-plugin:report package sonar:sonar
    
    addons:
      sonarcloud:
        organization: "my_organization_name_on_SonarCloud"
    
  3. Project's src/main/resources/sonar-project.properties

    sonar.projectKey=my_project_key_on_SonarCloud
    sonar.projectName=my_project_name
    sonar.projectVersion=0.0.1
    sonar.sources=.
    
  4. Jacoco-maven-plugin

    <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.3</version>
        <executions>
            <execution>
                <id>default-prepare-agent</id>
                <goals>
                    <goal>prepare-agent</goal>
                </goals>
                </execution>
            <execution>
                <id>default-report</id>
                <phase>prepare-package</phase>
                <goals>
                    <goal>report</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    

Following are the Travis CI Job logs

Setting environment variables from repository settings
$ export SONAR_TOKEN=[secure]
SonarCloud addon
addon hash: de356982c12b370c7bfe9c5317053863
Preparing SonarQube Scanner CLI
Archive:  /home/travis/.sonarscanner/sonar-scanner.zip
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner-debug.bat  
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-runner.bat  
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner.bat  
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-runner  
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner  
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/bin/sonar-scanner-debug  
creating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/conf/
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/conf/sonar-scanner.properties  
creating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/lib/
inflating: /home/travis/.sonarscanner/sonar-scanner-3.0.3.778/lib/sonar-scanner-cli-3.0.3.778.jar  
$ export SONAR_SCANNER_HOME=${TRAVIS_HOME}/.sonarscanner/sonar-scanner-3.0.3.778
Not installing SonarSource build-wrapper because it's a Java or Javascript project
Preparing SonarQube Scanner parameters0.00s
$ 
The command "" exited with 0.

Can somebody point out what I am missing here?

Thanks in advance.

Meena Chaudhary
  • 9,909
  • 16
  • 60
  • 94

1 Answers1

0

script: - mvn clean install -B - mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.projectKey=...

sudo: required addons: sonarcloud: organization: ... token: secure: $SONAR_TOKEN

Could you try like above

güven seckin
  • 99
  • 1
  • 4