2017-09-20 20 views
0

sonar-ant-task 1.4でサポートされていたbuild.xmlファイルをAnt 2.5のSonarQube Scannerのbuild.xmlに変更しています。 SonarQube 5.6.3。 salesforce languageカスタムプラグインのカスタムプラグインを作成して、それを最新バージョンにアップグレードしました。 build.xmlのは、私はどこ私はそれが間違って取得しています教えてください Sonar-Scanner for Ant発行

 <!-- Define the Sonar task --> 
     <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"> 
     <classpath path="sonar-ant-task-2.5.jar" /> 
     </taskdef> 

     <!-- define the force versions task --> 
     <taskdef name='scm' classname='com.villagechief.codescan.versions.ant.ScmCommitterTask'> 
     <classpath path="force-versions-0.2-SNAPSHOT.jar" /> 
     </taskdef> 

     <!-- Define the Salesforce task --> 
     <taskdef uri="salesforce" resource="com/salesforce/antlib.xml"> 
     <classpath path="ant-salesforce.jar" /> 
     </taskdef> 
     <!-- Add the target --> 
     <target name="sonar"> 
     <!--java srcdir="sonar-project-template\src" target="sonar-project-template\src" bootclasspath="C:\Program Files\Java\jdk1.8.0_145\jre\lib\rt.jar"/--> 
     <property name="sonar.host.url" value="Link to another server/" /> 

     <property Name="sonar.login" value="****"/> 
     <property Name="sonar.password" value="****"/> 

     <!-- db properties --> 
     <property name="sonar.jdbc.url" value="jdbc:sqlserver://<serverip>;databaseName=sonar" /> 
     <property name="sonar.jdbc.username" value="****" /> 
     <property name="sonar.jdbc.password" value="****" /> 


     <!-- location properties --> 
     <property name="sonar.sources" value="${user.dir}/src" /> 
     <property name="sonar.binaries" value="${user.dir}/bin" /> 
     <property name="sonar.tests" value="${user.dir}/tests" /> 
     <property name="sonar.libraries" value="${user.dir}/" /> 

     <!-- define if not already defined properties --> 
     <property name="sonar.language" value="sf" /> 
     <property name="salesforce.url" value="https://www.salesforce.com" /> 
     <property name="sonar.projectVersion" value="1.0-SNAPSHOT" /> 
     <sonar:sonar key="${sonar.projectKey}" version="${sonar.projectVersion}" xmlns:sonar="antlib:org.sonar.ant"/> 
     </target> 

     <target name="commit"> 
     <scm username="${salesforce.username}" password="${salesforce.password}" serverurl="${salesforce.url}" repository="${scm}" > 
       <fileset dir="${user.dir}/src"> 
        <include name="**/*"/> 
       </fileset> 
      </scm> 
     </target> 

     <target name="deletesrc"> 
     <delete dir="${user.dir}/src"> 
      <include name="**/*"/> 
      <exclude name="package.xml"/> 
     </delete> 

     </target> 
     <target name="download"> 
     <!-- Retrieve the contents listed in the file codepkg/package.xml into the codepkg directory --> 
     <sf:retrieve username="${salesforce.username}" password="${salesforce.password}" serverurl="${salesforce.url}" 
      retrieveTarget="src" unpackaged="src/package.xml"/> 
     <!-- 
     <sf:retrieve username="${salesforce.username}" password="${salesforce.password}" serverurl="${salesforce.url}" 
      retrieveTarget="src" packageNames=""/>--> 
     </target> 

     <target name="deploy"> 
     <!-- Retrieve the contents listed in the file codepkg/package.xml into the codepkg directory --> 
     <sf:deploy username="${salesforce.username}" password="${salesforce.password}" serverurl="${salesforce.url}" 
      deployroot="src"/> 
     </target> 

     <target name="commitall"> 
     <exec executable="git" dir="${user.dir}"> 
      <arg value="add"/> 
      <arg value="-A"/> 
     </exec> 
     <exec executable="git" dir="${user.dir}"> 
      <arg value="commit"/> 
      <arg value="-a"/> 
      <arg value="-m"/> 
      <arg value="&lt;automcommit: all&gt;"/> 
     </exec> 
     </target> 
     <!-- <target name="analyse" depends="deletesrc, download, commit, commitall, sonar" /> --> 
     <!--target name="analyse" depends="deletesrc, download, sonar" /--> 
    <target name="analyse" depends=" download, sonar" /> 
    </project> 
    ` 

`

を下回るようです。 #!/ bin/sh ant -f ../build.xml analyze 分析がログに正しく実行されていることを示すサーバーに送信されていません。だから、私はbuild.xmlに何か問題があると思う。だから私は助けが必要です。

これは私がコマンドを実行した後に取得するログです:アリ-fは、事前に

Buildfile: C:\runner\runner\antbuild.xml 

deletesrc: 

download: 
[sf:retrieve] Request for a retrieve submitted successfully. 
[sf:retrieve] Request Id for the current retrieve task: 04s90000003elivAAA 
[sf:retrieve] Waiting for server to finish processing the request... 
[sf:retrieve] Request Status: Completed 
[sf:retrieve] Finished request 04s90000003elivAAA successfully. 

sonar: 

analyse: 

BUILD SUCCESSFUL 
Total time: 15 seconds 

感謝を分析するbuild.xml!

+2

私はあなたの解析資格情報をStackOverflowに投稿しただけではありませんでした。それにもかかわらず私はそれらを脱いだ。しかし、十分な担当者を持つ人々は編集履歴でそれらを見ることができます。あなたがこれを投稿したときにあなたのコーヒーを持っていなかったという機会に、あなたは今あなたの資格情報を更新するべきです。 –

+0

また、問題の内容を実際には述べていません。 –

+0

分析結果がサーバーに送信されていないことをどのように知っていますか?分析ログのエラー?他に何か?また、SonarQubeのバージョンを含むように質問を編集してください –

答えて

0

私はあなたのエラーを飲み込む何見当がつかないが、私はあなたのbuild.xmlのみじん切りダウンバージョンで実行したときに、私が得た:

sonar:sonar doesn't support the "key" attribute 

実際には、sonar:sonarタグは任意のををサポートしていません。属性。だから大丈夫。すべての属性を削除して再試行してください:

You must define the following mandatory properties for 'Unknown': sonar.projectKey 

ので

<property name="sonar.projectKey" value="foo"/> 

と分析を追加することは美しく動作します。

しかし、私はまだ言及していない課題にいくつかの変更を加えました。まずSonarQubeの現代版(> 5.2)を前提とすると、データベース資格証明を分析に提供する必要がないので、それを取り除く必要があります。次に、5.3からSonarQubeのログインとパスワードを提供してはならず、generating a tokenをログイン値として渡すべきです。最後に、sonar.binariesは廃止予定です。代わりにsonar.java.binariesを使用してください。

+0

Build.xml antの実行をさらに深く理解してくれてありがとう。私はあなたが求めたように変更を加えました。プロパティキーを変数として作成する必要があります。私はその問題を解決してその問題を修正しても、次の問題が発生します さらに、それはthrows:\ runner \ runner \ build.xml:86:要素 "sonar:sonar"の接頭辞 "sonar"はバインドされていません。 build.xmlで問題が発生します。 xmlns:sonar = "antlib:org.sonar.ant"をプロジェクトに追加することで解決できます。 これを取得する必要があります。解決策を見つけようとする –

関連する問題