Sonar 4.2 在同一个项目中分析 Java 和 JavaScript

2024-05-09Java开发问题
1

本文介绍了Sonar 4.2 在同一个项目中分析 Java 和 JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

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

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

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

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

最近,Sonar 在 多语言分析="noreferrer">doc,我已经从 sonar-project.properties 中删除了 sonar.language.但它仍然只分析Java.

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.

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

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

我错过了什么吗?

sonar-project.properties:

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

谢谢

推荐答案

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

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 将自动从/java 进行 java 分析,并从/webapp 进行 javascript 分析

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

这篇关于Sonar 4.2 在同一个项目中分析 Java 和 JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

如何使用 JAVA 向 COM PORT 发送数据?
How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)...
2024-08-25 Java开发问题
21

如何使报表页面方向更改为“rtl"?
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)...
2024-08-25 Java开发问题
19

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

有没有办法在 Java 中检测 RTL 语言?
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)...
2024-08-25 Java开发问题
11

如何在 Java 中从 DB 加载资源包消息?
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)...
2024-08-25 Java开发问题
13

如何更改 Java 中的默认语言环境设置以使其保持一致?
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)...
2024-08-25 Java开发问题
13