-->

Sonar 4.2 analysis both Java and JavaScript in sam

2019-02-17 08:12发布

问题:

I'm trying to analyse my JEE project with Sonar 4.2. It's a multi-language JEE project with Java and JS.

The plugins I've added to my Sonar 4.2 are : Java 2.1 and JavaScript 1.6.

Recently, Sonar added the multi-language analysis, following the doc, I've removed the sonar.language from sonar-project.properties. But it still analyse only the Java.

I'm using Sonnar Runner 2.3 in Jenkins 1.555. It analyse the project after every build.

Am I missing something ?

Edit : sonar-project.properties :

# Required metadata
sonar.projectKey=myProjectKey
sonar.projectName=MyProject
sonar.projectVersion=1.0

# Path to the parent source code directory.
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional. If not set, SonarQube starts looking    for source code
# from the directory containing the sonar-project.properties file.
sonar.sources=src/main/java

# Encoding of the source code
sonar.sourceEncoding=UTF-8

Thanks

回答1:

You have Sonar looking for source code from src/main/java, so it won't find your js code. Change it to:

  sonar.sources=src/main

Sonar will automatically make the java analysis from /java, and the javascript analysis from /webapp