Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project with both java and javascript in sonarqube using gradle

We have a pretty standard web project using Java, which contains also some javascript code in the standard src/main/webapp folder. We are using Gradle 2.14 as our build tool.

We have just installed a brand new Sonarqube 6.0.1 on a fresh server, checked that both the Java and Javascript plugins are installed, and modified the build.gradle file as recommended on the Sonarqube documentation:

plugins {
    id 'org.sonarqube' version '2.0.1'
}

sonarqube {
    properties {
        property 'sonar.projectName', 'Our-Project'
        property 'sonar.projectKey', 'com.ourcompany:our-project'
    }
}

This doesn't work as expected: the java code is analyzed correctly and we can browse the results on sonar, but the javascript code isn't analyzed.

What are we doing wrong? Thanks.

like image 535
Andrea Bergia Avatar asked Aug 29 '16 15:08

Andrea Bergia


People also ask

How do you integrate SonarQube with Gradle project?

login property in your command line or you configure it as part of your gradle. properties file. Execute gradle sonarqube -Dsonar. login=yourAuthenticationToken and wait until the build has completed, then open the web page indicated at the bottom of the console output.

Can Gradle be used for JavaScript?

For Android projects, Google have made Gradle the de facto build tool. It's getting a name for its flexibility, so when the opportunity came to build a single page Javascript webapp we decided to put the latest addition to the polyglot build tool arsenal through its paces.

Does SonarQube work with JavaScript?

Feature 1: Multi-Language Support. By default, SonarQube supports 27 programming languages. These include Java, JavaScript, C#, Python, Golang, HTML5, CSS3, PL/SQL, and many more.

Does SonarQube only analysis Java code?

SonarQube is an open source quality management platform, designed to analyze and measure your code's technical quality. It is used to test code written in the main programming languages such as C/C++, JavaScript, Java, C#, PHP, and Python, and even a combination of several languages simultaneously.


1 Answers

I have managed to fix our issues by adding this property inside the sonarqube block:

property 'sonar.sources', 'src/main'
like image 184
Andrea Bergia Avatar answered Sep 28 '22 16:09

Andrea Bergia