2
votes

I'm trying to use the travis-ci integrated with sonarqube with Gradle, but I can not.

My .travis.yml

language: java
jdk:
- oraclejdk11
before_install:
- chmod +x gradlew
dist: trusty
before_cache:
- rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
  directories:
  - $HOME/.gradle/caches/
  - $HOME/.gradle/wrapper/
addons:
  sonarcloud:
    organization: "rjdesenvolvimento-github"
    token:
      secure: 5150fa5cbf1f86006a140e0b8a96e632c2e63
script:
- ./gradlew sonarqube \
  -Dsonar.projectKey=rjdesenvolvimento_apipessoas \
  -Dsonar.organization=rjdesenvolvimento-github \
  -Dsonar.host.url=https://sonarcloud.io \
  -Dsonar.login=5150fa5cbf1f86006a140e0b8a96e632c2e63

And the error:

FAILURE: Build failed with an exception. * What went wrong: Task ' -Dsonar.projectKey=rjdesenvolvimento_apipessoas' not found in root project 'apipessoas'. * Try: Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 5s

The command "./gradlew sonarqube \ -Dsonar.projectKey=rjdesenvolvimento_apipessoas \ -Dsonar.organization=rjdesenvolvimento-github \ -Dsonar.host.url=https://sonarcloud.io \ -Dsonar.login=5150fa5cbf1f86006a140e0b8a96e6386a2c2e63" exited with 1.

before_cache.1 0.00s$ rm -f $HOME/.gradle/caches/modules-2/modules-2.lock before_cache.2 0.00s$ rm -fr $HOME/.gradle/caches/*/plugin-resolution/ cache.2 store build cache

If anyone can help, I'm lost.

1
Could you please try with the whole command in a single line? I guess yaml is messing sth up.Opal
Thanks sir. Works like a charm. Save my day!Rodrigo Batista

1 Answers

2
votes

If you could please try the whole command inlined:

script:
- ./gradlew sonarqube -Dsonar.projectKey=rjdesenvolvimento_apipessoas -Dsonar.organization=rjdesenvolvimento-github -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=5150fa5cbf1f86006a140e0b8a96e632c2e63

I guess it's yaml that messes something up.