user1799537
user1799537

Reputation:

How to get results of sonar ant task and published them on Jenkins?

I prepare ant task for sonar and it works(i see results on sonar page and build is successful). But how to show results of analize in jenkins? I see no results in my workdir.

<target name="sonar" depends="depended targets">
    <!-- Execute Sonar -->
    <property name="sonar.projectVersion" value="1.0" />
    <sonar:sonar key="key" version="1.0" xmlns:sonar="antlib:org.sonar.ant">
        <sources>
            <path location="someSrcDir1" />
            <path location="someSrcDir2" />
            <path location="someSrcDir3" />
        </sources>

         <binaries>
            <path location="someDirWithBin1" />
            <path location="someDirWithBin1" />
            <path location="someDirWithBin1" />
            <path location="someDirWithBin1" />
         </binaries>    
    </sonar:sonar>
</target>

How to get and publish results in Jenkins?

Upvotes: 1

Views: 493

Answers (1)

There's no way to publish Sonar results into Jenkins, those are 2 different products used for different purposes. After a Sonar analysis has been executed by a Jenkins job, you have to go to the Sonar Web interface to get the results.

The only thing you can get is a link from Jenkins to Sonar, but it is only available when using Maven or the Sonar standalone build step (and what's more, it is a bit buggy).

Upvotes: 1

Related Questions