2

I am trying to integrate Sonar task in Ant build in Eclipse. SonarQube server is running successfully at the default port on localhost. On opening "http://localhost:9000/" in browser, SonarQube web interface is successfully opening.

Problem is when I am running Sonar task from Ant build file it is giving error "org.sonar.runner.impl.RunnerException: Unable to execute Sonar". That's it. No stacktrace is logged on console.

The sonar task in ANt build is defined as below:

<target name="sonar" depends="jcompile">        
         <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
            <classpath path="<PathToAntPlugin>/lib/sonar-ant-task-2.2.jar" />
         </taskdef>                      
        <property name="sonar.projectDescription" value="Example application using Ant and Jacoco" />
        <property name="sonar.sources" value="${basedir}/src" />         
        <property name="sonar.host.url" value="http://localhost:9000"/>          
        <property name="sonar.surefire.reportsPath" value="${reports.junit.xml.dir}" />          
        <property name="sonar.core.codeCoveragePlugin" value="jacoco" />
        <property name="sonar.jacoco.antTargets" value="run-tests" />
        <property name="sonar.projectKey" value="<PathToMyProject>" />
        <property name="sonar.projectVersion" value="1.0" />            
        <sonar:sonar xmlns:sonar="antlib:org.sonar.ant"/>           
</target>

Other details: SonarQube Server 4.5, sonar-ant-task-2.2.jar, JDK 1.6.0_21, Eclipse Kepler

Is there any comptability issue between the jdk, eclipse, sonar server or sonar ant jar? Is there any way to find the detail logs in order to debug the issue?

Apart from above issue, I am having other issue. When I am installing SonarCube plugin in eclipse, in Windows ->Preferences SonarCube is not coming. However, in installed software list in Eclipse it is listed. I have tried to run eclipse with -clean option but no success. Please let me know what could be the problem?

Infotechie
  • 1,653
  • 6
  • 23
  • 35

2 Answers2

1

When we are running the build file from eclipse it is not giving full stack trace on console in some cases. Try to run the build file from the command prompt.

For example:

Open command prompt window and go to eclipse ant bin directory path(In my system it is C:\eclipse\plugins\org.apache.ant_1.9.6.v201510161327\bin) and from here run your build file using ant command.

    C:\eclipse\plugins\org.apache.ant_1.9.6.v201510161327\bin>ant -buildfile [path_of_build_file]\build-test.xml

I know I am late, but this is to help who visits this with same problem

Rajashekhar
  • 469
  • 3
  • 11
0

For the missing preferences, the Installation FAQ of Sonar says to do a restart with -clean argument.

Bananeweizen
  • 21,797
  • 8
  • 68
  • 88