简体   繁体   English

SonarQube Eclipse插件未遵循Eclipse链接,并且“ sonar.sources”必须是相对路径

[英]SonarQube Eclipse plugin doesn't follow Eclipse links, and “sonar.sources” must be relative path

  • Eclipse: "Luna" Release 2 (4.4.2) [20150219-0600] Eclipse:“ Luna”版本2(4.4.2)[20150219-0600]
  • Sonar: 5.1 (under Java 1.7.0_76) 声纳:5.1(在Java 1.7.0_76下)
  • Sonar Eclipse plugin: 3.5.0.20150804-1512-RELEASE 声纳Eclipse插件:3.5.0.20150804-1512-RELEASE

We have a large Enterprise system with many projects, and for various non-negotiable reasons we create our Eclipse projects in a local workspace directory but use Eclipse links to point to the sources in another directory. 我们有一个大型的Enterprise系统,其中包含许多项目,并且由于各种不同的原因,我们在本地工作空间目录中创建Eclipse项目,但是使用Eclipse链接指向另一个目录中的源。

For example, assume that my Foo project is based in "C:/EclipseWorkspace/Foo" and has an "src" link at the top level like this: 例如,假设我的Foo项目基于“ C:/ EclipseWorkspace / Foo”,并且在顶层具有“ src”链接,如下所示:

 C:/EclipseWorkspace/Foo/src -> C:/CodeRepository/Foo/src

I wanted to have the following very simple setup for the plugin: 我想对插件进行以下非常简单的设置:

 sonar.sources = C:/CodeRepository/Foo/src

The problem is, the Sonar Eclipse plugin does not appear to support using an absolute path. 问题是,Sonar Eclipse插件似乎不支持使用绝对路径。 When I run an analysis I get the following error on the console: 运行分析时,在控制台上出现以下错误:

Retrieve remote issues of project Foo...
Start SonarQube analysis on Foo...
INFO: SonarQube Server 5.1
17:16:18.565 INFO  - Incremental mode
17:16:18.609 INFO  - Load global repositories
17:16:18.862 INFO  - Load global repositories (done) | time=253ms
17:16:18.863 INFO  - Server id: 20150910100331
17:16:18.865 INFO  - User cache: C:\Users\eryq\.sonar\cache
17:16:18.870 INFO  - Install plugins
17:16:18.894 INFO  - Include plugins: 
17:16:18.894 INFO  - Exclude plugins: devcockpit, buildstability, pdfreport, report, buildbreaker, views, jira
17:16:19.375 ERROR - Invalid value of sonar.sources for Foo
Exception in thread "main" org.sonar.runner.impl.RunnerException: Unable to execute Sonar 
    ...
Caused by: java.lang.IllegalStateException: The folder 'C:/CodeRepository/Foo/src' does not exist for 'Foo' (base directory = C:\EclipseWorkspace\Foo)
    at org.sonar.batch.scan.ProjectReactorBuilder.checkExistenceOfPaths(ProjectReactorBuilder.java:427)
    at ...

Notice that last line: 注意最后一行:

The folder 'C:/CodeRepository/Foo/src' does not exist for 'Foo' (base directory = C:\\EclipseWorkspace\\Foo) “ Foo”的文件夹“ C:/ CodeRepository / Foo / src”不存在(基本目录= C:\\ EclipseWorkspace \\ Foo)

Since the Eclipse plugin does not allow me to override the projectBaseDir , how do I make it understand that the sonar.sources are actually in another directory outside that tree? 由于Eclipse插件不允许我覆盖projectBaseDir ,我如何使其理解sonar.sources实际上位于该树之外的另一个目录中? This seems like a plugin bug: if I need to point to a list of sources directories, the plugin should let me specify absolute paths if needed. 这似乎是一个插件错误:如果我需要指向目录列表,则该插件应在需要时让我指定绝对路径。

Thanks in advance, 提前致谢,

Eryq 艾瑞克

This is not specific to SonarQube Eclipse and not related to absolute path: any SonarQube analysis requires to have source folders located under the project baseDir. 这并非特定于SonarQube Eclipse,也不涉及绝对路径:任何SonarQube分析都需要在项目baseDir下放置源文件夹。

Allowing you to override sonar.projectBaseDir is an easy fix. 允许您覆盖sonar.projectBaseDir是一个简单的解决方案。 But I'm not sure this would not lead to other issues later when issues are mapped to Eclipse resources... Feel free to test and submit a pull request. 但是我不确定在将问题映射到Eclipse资源后,这是否会导致其他问题...请随意测试并提交请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM