java - Sonar-runner执行失败导致cast异常

标签 java android mysql sonarqube sonar-runner

配置 Sonar 工具(SonarQube、MySql 数据库和 Sonar-runner)后,我对一个 Android 项目进行了分析,没有任何问题。但是在安装 Sonar 的 Android 插件并重复分析之后,这个失败了,出现下一个错误:

INFO  - Preview mode
Load batch settings
User cache: /home/user/.sonar/cache
INFO  - Install plugins
INFO  - Exclude plugins: devcockpit, jira, pdfreport, views, report, buildstability, scmactivity, buildbreaker
INFO  - Create JDBC datasource for jdbc:h2:/home/user/workspace/myAndroidProject/.sonar/.sonartmp/preview1394469024394-0
INFO  - Initializing Hibernate
INFO  - Load project settings
INFO  - Apply project exclusions
INFO  - -------------  Scan myAndroidProject
INFO  - Load module settings
INFO  - Language is forced to java
INFO  - Loading technical debt model...
INFO  - Loading technical debt model done: 424 ms
INFO  - Configure Maven plugins
INFO  - Base dir: /home/user/workspace/myAndroidProject
INFO  - Working dir: /home/user/workspace/myAndroidProject/.sonar
INFO  - Source dirs: /home/user/workspace/myAdnroidProject/src
INFO  - Source encoding: UTF-8, default locale: en_EN
INFO  - Index files
INFO  - Included sources: 
INFO  -   src/**
INFO  - 116 files indexed
WARN  - Accessing the filesystem before the Sensor phase is deprecated and will not be supported in the future. Please update your plugin.
INFO  - Index files
INFO  - Included sources: 
INFO  -   src/**
INFO  - 116 files indexed
WARN  - Accessing the filesystem before the Sensor phase is deprecated and will not be supported in the future. Please update your plugin.
INFO  - Index files
INFO  - Included sources: 
INFO  -   src/**
INFO  - 116 files indexed
INFO  - Quality profile for java: Sonar way
INFO  - Sensor JavaSourceImporter...
INFO  - Sensor JavaSourceImporter done: 49 ms
INFO  - Sensor JavaSquidSensor...
INFO  - Java AST scan...
INFO  - 116 source files to be analyzed
INFO  - 116/116 source files analyzed
INFO  - Java AST scan done: 6693 ms
WARN  - Java bytecode has not been made available to the analyzer. The Depth of Inheritance Tree (DIT) metric, Response for Class (RFC) metric, Number of Children (NOC) metric, Lack of Cohesion (LCOM4) metric, deperecated dependencies metrics, UnusedPrivateMethod rule, RedundantThrowsDeclarationCheck rule, S1160 rule, S1217 rule are disabled.
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 18.440s
Final Memory: 12M/357M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
ERROR: Unable to execute Sonar
ERROR: Caused by: org.sonar.api.resources.Directory cannot be cast to    org.sonar.api.resources.JavaPackage

我的 sonar-project.properties 文件是 enxt:

#Required metadata
sonar.projectKey=mKey
sonar.projectName=myAndroidProject
sonar.projectVersion=1.0

# Paths to source directories.
# Paths are relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Do not put the "sonar-project.properties" file in the same directory with the source code.
# (i.e. never set the "sonar.sources" property to ".")
sonar.sources=src

# The value of the property must be the key of the language.
sonar.language=java

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

# Analysis mode
sonar.analysis.mode=preview


#Enables the Lint profile to analyze the code using the Lint rules.
#sonar.profile=Android Lint

我正在使用下一个环境:

  • SonarQube 4.2 RC1
  • Sonar 跑者 2.3
  • 数据库:MySQL
  • Ubuntu 12.04 LTS
  • Java 1.7

我尝试卸载 Android 插件,但问题仍然存在。我发现解决它的独特方法是删除数据库和用户并重新创建它们。

最佳答案

关于java - Sonar-runner执行失败导致cast异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22306370/

相关文章:

php - 是否可以在同一个 sql 查询中进行插入或更新?

mysql - 确定字段中的最大字符数

java - 在 Java 中格式化*相对*时间量(毫秒)?

java - Hibernate:多个表,同一个对象

mysql - 返回 table1 中的计数等于 table2 中的计数的所有 id

android - 如何正确使用 JobService?

Android 授予应用程序的可持久 uri 权限的最大数量限制为 128?

java - 如何在 Java 7 中启用 TLSv1.2?

java - hibernate 。 PSQL异常 : bad value for type int : admin

java - android 5.0及以上版本不显示应用栏标题