从 sonarrunner 中恢复,使数据库处于不一致状态

Recover from sonarrunner leaving DB in inconsistent state

Sonar maven 插件 运行 由于内存不足而失败。我试图 运行 它针对一个模块来调试一些东西...

[INFO] [16:16:07.709] Execute PMD 5.4.0 done: 10861 ms
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:07 min
[INFO] Finished at: 2015-12-30T16:16:08+01:00
[INFO] Final Memory: 76M/953M
[INFO] ------------------------------------------------------------------------
---------------------------------------------------
constituent[0]: file:/usr/share/maven3/lib/wagon-http-2.6-shaded.jar
[SNIP...]
constituent[39]: file:/usr/share/maven3/conf/logging/
---------------------------------------------------
Exception in thread "main" 
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"

现在,当我尝试在所有模块上 运行 声纳时,它告诉我:The project 'foo:module1' is already defined in SonarQube but not as a module of project 'foo:aggregator'

但是当我去声纳的时候:

我尝试 运行 完成分析,希望它会添加项目,以便我稍后可以删除它,但我得到:

[INFO] [17:17:17.805] Execute decorators...
[WARN] [17:17:33.408] Too many components under resource 'module1'. DSM will not be displayed.
[INFO] [17:17:33.526] Store results in database
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:19 min
[INFO] Finished at: 2015-12-30T17:17:33+01:00
[INFO] Final Memory: 57M/1044M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project module1: Unable to save file sources:
[ERROR] ### Error updating database.  Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '34503e95-81ac-40bb-a73c-60325a11088c' for key 'file_sources_file_uuid_uniq'
[ERROR] ### The error may involve org.sonar.core.source.db.FileSourceMapper.insert-Inline
[ERROR] ### The error occurred while setting parameters
[ERROR] ### SQL: INSERT INTO file_sources (project_uuid, file_uuid, created_at, updated_at, binary_data, line_hashes, data_hash, src_hash)     VALUES (?, ?, ?,     ?, ?, ?,     ?, ?)
[ERROR] ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '34503e95-81ac-40bb-a73c-60325a11088c' for key 'file_sources_file_uuid_uniq'

我如何 'delete' 来自声纳的 foo:module1 以便我可以 运行 在 foo:aggregator

上进行分析

我能做的最好的事情就是使用 批量删除 删除 module1 这带走了所有模块的数据。

很明显,您只需在 Maven 子模块上执行运行程序即可处理 Sonar 数据。干得好!