How to configure checkstyle in sonarqube in Java?

73 views Asked by At

I am using checkstyle and sonarqube in my application for which the config is defined in pom.xml as :

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-checkstyle-plugin</artifactId>
    <version>2.17</version>
    <configuration>
        <linkXref>true</linkXref>
        <skip>false</skip>
        <consoleOutput>true</consoleOutput>
        <logViolationsToConsole>true</logViolationsToConsole>
        <configLocation>${sonarqube.url}/api/qualityprofiles/export?exporterKey=checkstyle&amp;language=java</configLocation>
        <!-- <configLocation>${sonarqube.url}/profiles?format=checkstyle&amp;language=java&amp;name=Cobra</configLocation> -->
        <failsOnError>true</failsOnError>
        <failOnViolation>true</failOnViolation>
        <violationSeverity>warning</violationSeverity>
        <includeTestSourceDirectory>true</includeTestSourceDirectory>
    </configuration>
    <executions>
        <execution>
            <phase>validate</phase>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

But when I am trying to build it , I am getting an error saying

Unable to find configuration file at location: http://xx.xxx.xxx.xxx:9000/api/qualityprofiles/export?exporterKey=checkstyle&language=java: Could not find resource 'http://xx.xxx.xxx.xxx:9000/api/qualityprofiles/export?exporterKey=checkstyle&language=java'

But when I am hitting the same URL on browser it is working fine and I getting the desired result . Could anyone help what can be the issue ??

Thanks

0

There are 0 answers