Recently in the sonar scan of things, has been only scanning Java code, so that the statistics of the data escalation leader many developers do not obey (say I do not have to write JSP to write JS? ),
So good, so continue to the whole sonar, in the official website to see Sonar actually has JS, JSP plug-in, so that you can achieve the scan JS and JSP.
Installing the sonar server here's no detail.
To scan JS, JSP that must give sonar server add plug-in, add-ons can be added in the Sonar Update center, you can also download the jar package to the sonar plugins
1) JavaScript code check: Http://docs.codehaus.org/display/SONAR/JavaScript+Plugin
2) Web page check (HTML, JSP, JSF, Ruby, PHP, etc.): Http://docs.codehaus.org/display/SONAR/Web+Plugin
First, MAVEN project scan Java, JS, JSP
Sonar provides the integration of MAVEN, so MAVEN project scan is very simple (sonar integrated MAVEN does not elaborate here, online a lot of articles)
So sonar how to scan the information of three languages, very simple, configuration pom.xml, the resource path of sonar scan into Java, JSP, JS the root path of the resource is finished
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> < Sonar.sources>src</sonar.sources></properties>
After scanning sonar shows the situation:
Second, general Web project scanning
General projects recommend using Sonar-runner,sonar-runner and sonar integration to achieve the scanning effect,
Here you need to configure sonar-project.properties and then use Sonar-runner to scan
#required metadata #projectKey项目的唯一标识, cannot repeat sonar.forceauthentication=falsesonar.login=saqsonar.password= 000000 sonar.projectkey=testusersonar.projectname=testusersonar.projectversion=1.0 sonar.sourceEncoding= UTF-8 sonar.modules=java-module,javascript-module,html-module # java Module Java-module.sonar.projectname=java module Java-module.sonar.language=java #. Indicates the directory projectbasedir specified java-module.sonar.sources=. Java-module.sonar.projectbasedir=src/main/java sonar.binaries=classes # JavaScript Module Javascript-module.sonar.projectname=javascript Module javascript-module.sonar.language=js Javascript-module.sonar.sources=js Javascript-module.sonar.projectbasedir=src/main/webapp # Html Module html-module.sonar.projectname=html module html-module.sonar.language=web Html-module.sonar.sources=pages Html-module.sonar.projectbasedir=src/main/webapp
Sonar scans Java, JS, JSP technology