Sonar Ant task execution error

2019-08-12 06:56发布

I wrote the ant sonar task but when i am executing in the console i am getting following error

 E:\Liferay\Liferay 6.2\workspace\plugins\build.xml:305: 
 org.sonar.batch.bootstrapper.BootstrapException: java.io.IOException: 
 Server returned HTTP response code: 400 for URL: http://localhost:9000/sonar/batch/

Even i have tried in all the ways The following is my ant target

<target name="sonar">
            <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
                    <!-- Update the following line, or put the "sonar-ant-task-*.jar" file in your "$HOME/.ant/lib" folder -->
                    <classpath path="D:\sonar-ant-task-1.3.jar" />
            </taskdef>

            <property name="sonar.host.url" value="http://localhost:9000/sonar" />  
            <property name="sonar.jdbc.url" value="jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8" />
            <property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" />

            <!-- the username and password of your database -->
            <property name="sonar.jdbc.username" value="root" />
            <property name="sonar.jdbc.password" value="" />

            <!-- list of mandatories Sonar properties -->
            <property name="sonar.sources" value="portlets/${projectName}/docroot/WEB-INF/src" />
            <property name="sonar.projectName" value="${projectNameInSonarPortal}" />       
            <property name="sonar.binaries" value="portlets/${projectName}/docroot/WEB-INF/classes" />
            <property name="sonar.libraries" value="portlets/${projectName}/docroot/WEB-INF/lib" />

            <!-- The console info -->
            <echo>The given project name ${projectName}></echo>
            <echo>The project name in sonar portal ${projectNameInSonarPortal}</echo>
            <echo>The sonar sources directory ${sonar.sources}</echo>
            <!-- Execute Sonar -->
             <sonar:sonar />
            <!--<sonar:sonar key="encore-portal" version="0.1-SNAPSHOT"  xmlns:sonar="antlib:org.sonar.ant"/>-->
        </target>

The properties set in sonar.properties

sonar.web.host: localhost
sonar.web.port: 9000
sonar.web.context: /sonar
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8
sonar.jdbc.driverClassName: com.mysql.jdbc.Driver

Can anyone help on this.I have googled but all the solutions did not work for me.I spent lot time on this.Please add fortune hands with my hands

0条回答
登录 后发表回答