2017-04-03 6 views
1

私はtravisでSonarQube.comを設定しようとしていますMavenプロジェクトのために、私は、ビルドに次の例外を参照してください。ここで目標org.sonarsource.scanner.mavenを実行できませんでした:sonar-maven-plugin:3.3.0.603:プロジェクトjraftのソナー(default-cli):ガバナンスのライセンスなし

[INFO] User cache: /home/travis/.sonar/cache 
[INFO] Load global settings 
[INFO] Load global settings (done) | time=456ms 
[INFO] User cache: /home/travis/.sonar/cache 
[INFO] Load plugins index 
[INFO] Load plugins index (done) | time=16ms 
[INFO] Download sonar-scm-cvs-plugin-1.0.jar 
[INFO] Download sonar-scm-svn-plugin-1.3.jar 
[INFO] Download sonar-plsql-plugin-2.9.0.901.jar 
[INFO] Download sonar-csharp-plugin-5.8.0.660.jar 
[INFO] Download sonar-java-plugin-4.7.1.9272.jar 
[INFO] Download sonar-web-plugin-2.5.0.476.jar 
[INFO] Download sonar-flex-plugin-2.3.jar 
[INFO] Download sonar-xml-plugin-1.4.2.885.jar 
[INFO] Download sonar-vbnet-plugin-3.0.3.346.jar 
[INFO] Download sonar-swift-plugin-2.0.0.1127.jar 
[INFO] Download sonar-python-plugin-1.7.0.1195.jar 
[INFO] Download sonar-github-plugin-1.4.0.699.jar 
[INFO] Download sonar-cfamily-plugin-4.6.0.7071.jar 
[INFO] Download sonar-auth-github-plugin-1.3.jar 
[INFO] Download sonar-rpg-plugin-2.1.0.736.jar 
[INFO] Download sonar-scm-mercurial-plugin-1.1.1.jar 
[INFO] Download sonar-googleanalytics-plugin-1.1.jar 
[INFO] Download sonar-widget-lab-plugin-1.8.1.jar 
[INFO] Download sonar-pli-plugin-1.5.0.702.jar 
[INFO] Download sonar-javascript-plugin-2.21.0.4409.jar 
[INFO] Download sonar-groovy-plugin-1.4.jar 
[INFO] Download sonar-cobol-plugin-3.3.1.1636.jar 
[INFO] Download sonar-scm-git-plugin-1.2.jar 
[INFO] Download sonar-php-plugin-2.10.0.2087.jar 
[INFO] Download sonar-abap-plugin-3.3.jar 
[INFO] Download sonar-governance-plugin-2.0.0.1789.jar 
[INFO] Download qualinsight-sonarqube-badges-3.0.1.jar 
[INFO] SonarQube version: 6.3.0 
[INFO] Default locale: "en_US", source code encoding: "UTF-8" 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 01:42 min 
[INFO] Finished at: 2017-04-03T09:47:20+00:00 
[INFO] Final Memory: 70M/468M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.3.0.603:sonar (default-cli) on project jraft: No license for governance -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 

.travis.ymlです:ここでは

language: java 
jdk: 
    - oraclejdk8 

addons: 
    sonarqube: 
    organization: ${SONAR_ORGANIZATION} 
    token: 
     secure: ${SONAR_TOKEN} 

script: 
    - ./travis.sh 

cache: 
    directories: 
    - $HOME/.m2/repository 
    - $HOME/.sonar 
    - $HOME/jvm 
    - $HOME/maven 

travis.shです:

#!/bin/bash 

set -e 

INITIAL_VERSION=1.0-SNAPSHOT 

export MAVEN_OPTS="-Xmx1G -Xms128m" 

mvn package sonar:sonar \ 
    $MAVEN_ARGS \ 
    -Dsonar.host.url=$SONAR_HOST_URL \ 
    -Dsonar.login=$SONAR_TOKEN \ 
    -Dsonar.projectVersion=$INITIAL_VERSION 

このエラーが表示される理由No license for governance商用ソナーコンポーネントを使用していないためです(私が想定しているsonar-javaのみ)。

この問題は、プラグインの1つに商用キーが必要だという事実に関連しているようですが、TravisにJavaプラグインのみをインストールするように指示する方法はありますか?

+0

から動作します。それでも、あなたのリポジトリ(https://github.com/dzlab/jraft)で、「スタートガイド」ガイド(http://about.sonarqube.com/get)にあるMavenベースのプロジェクトに従わなかったことがわかります-started /)。何らかの理由? –

+0

OK、あなたの問題を発見しました、下の私の答えを参照してください。 –

+0

@ Fabrice-SonarSourceTeamご意見ありがとうございますが、私はあなたの答えを見ていない! – bachr

答えて

3

リポジトリを見てみると、あなたは、トラヴィスのアドオンあなたのために指定された様々なパラメータをオーバーライドするべきではありません。あなたは(line 12で)MavenのコマンドラインでSONAR_TOKENを上書きするとき

具体的には、結果はあなたの.travis.ymlファイルのline 11で暗号化され、合格したトークンが完全に払拭されていることです。このため、分析は匿名の場合と同様に実行されます。

のでGet Startedガイドに従ってくださいと単純に次のMavenコマンドを実行します。私にとって

mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar 
+0

mvnコールのすべての追加パラメータを削除していただきありがとうございます。 – bachr

+0

なぜsonarqubeソースで追加のパラメータをmavenソナープラグインhttps://github.com/SonarSource/sonarqube/blob/master/travis.sh#L147-L152 – bachr

+1

に設定しているのですか?トラビスアドオンを使用していないので、 –

0

ソナーガバナンスプラグインは市販のプラグインです。 チェックhere

..... 
[INFO] Download sonar-governance-plugin-2.0.0.1789.jar 
...... 
0

以下は、私はあなたの問題を再現することはできません私のジェンキンスパイプライン

node{ 
    stage 'Code Quality' 
    sh "mvn sonar:sonar -Dsonar.host.url=http://<hostname>:9000" 
} 
関連する問題