【问题标题】:Sonar 4.2 analysis both Java and JavaScript in same projectSonar 4.2 在同一个项目中分析 Java 和 JavaScript
【发布时间】:2014-06-08 05:31:38
【问题描述】:

我正在尝试使用 Sonar 4.2 分析我的 JEE 项目。这是一个多语言 JEE项目,包含Java和JS。

我添加到 Sonar 4.2 的插件有:Java 2.1 和 JavaScript 1.6。

最近,Sonar 添加了 多语言 分析,在 doc 之后,我从 sonar-project.properties 中删除了 sonar.language 。但它仍然只分析Java。

我在 Jenkins 1.555 中使用 Sonnar Runner 2.3。它会在每次构建后分析项目。

我错过了什么吗?

编辑: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

谢谢

【问题讨论】:

  • 你能提供你的 sonar-project.properties 文件的内容吗?
  • 你可以看到我的编辑。文档中没有提到sonar.language。我的 JS 文件位于:src/main/webapp/ui

标签: java javascript code-analysis multilingual sonarqube


【解决方案1】:

您让 Sonar 从 src/main/java 中寻找源代码,所以它不会找到您的 js 代码。 将其更改为:

  sonar.sources=src/main

Sonar 将自动从 /java 进行 java 分析,并从 /webapp 进行 javascript 分析

【讨论】:

  • 我们还没有配置 sonar.sources 并且我们正在使用 sonar maven 插件,所以它选择了 src 作为源文件夹,但它没有选择我们在“资源”文件夹中的 js 文件。我试图在 sonar.inclusions 中添加它,但没有锁定。据我了解,maven plugin 3.0.1 应该检测多语言,对吗?我错过了什么吗?
猜你喜欢
  • 2018-11-18
  • 1970-01-01
  • 1970-01-01
  • 2016-06-13
  • 2018-01-30
  • 1970-01-01
  • 2014-07-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多