声纳专家构建正在下降

发布于 2025-01-03 11:36:21 字数 5308 浏览 1 评论 0原文

当我尝试在项目根目录中运行 mvn sonar:sonar -e 时,构建会出现错误:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar

Embedded error: Unable to read and import the source file : '/www/hudson/proj_beta/source/bin/report.php' with the charset : 'UTF-8'.
org.sonar.api.resources.File@10ade81[key=bin/report.php,dir=bin,filename=report.php,language=PHP]
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:103)
        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:79)
        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:88)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.sonar.api.utils.SonarException: Unable to read and import the source file : '/www/hudson/c2c_beta/source/bin/report.php' with the charset : 'UTF-8'.
        at org.sonar.api.batch.AbstractSourceImporter.parseDirs(AbstractSourceImporter.java:84)
        at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:69)
        at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:60)
        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
        at org.sonar.batch.phases.Phases.execute(Phases.java:93)
        at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:111)
        at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:101)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:102)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.Batch.execute(Batch.java:100)
        at org.sonar.maven.SonarMojo.executeBatch(SonarMojo.java:152)
        at org.sonar.maven.SonarMojo.execute(SonarMojo.java:142)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:98)
        ... 21 more
Caused by: org.sonar.api.resources.DuplicatedSourceException: org.sonar.api.resources.File@10ade81[key=bin/report.php,dir=bin,filename=report.php,language=PHP]
        at org.sonar.batch.index.SourcePersister.saveSource(SourcePersister.java:45)
        at org.sonar.batch.index.DefaultPersistenceManager.setSource(DefaultPersistenceManager.java:78)
        at org.sonar.batch.index.DefaultIndex.setSource(DefaultIndex.java:402)
        at org.sonar.batch.DefaultSensorContext.saveSource(DefaultSensorContext.java:159)
        at org.sonar.api.batch.AbstractSourceImporter.parseDirs(AbstractSourceImporter.java:81)
        ... 37 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 23 seconds
[INFO] Finished at: Wed Feb 08 14:50:49 EET 2012
[INFO] Final Memory: 16M/42M
[INFO] ------------------------------------------------------------------------

在将单元测试添加到源目录后,它开始下降。 谷歌搜索没有给出任何线索。

该文件采用 utf-8 格式: report.php:文本/纯文本; charset=utf-8

有什么建议吗?

When I try to run mvn sonar:sonar -e in projects root dir build is falling with error:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar

Embedded error: Unable to read and import the source file : '/www/hudson/proj_beta/source/bin/report.php' with the charset : 'UTF-8'.
org.sonar.api.resources.File@10ade81[key=bin/report.php,dir=bin,filename=report.php,language=PHP]
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:284)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
        at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
        at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
        at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:103)
        at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:79)
        at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:88)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
        ... 17 more
Caused by: org.sonar.api.utils.SonarException: Unable to read and import the source file : '/www/hudson/c2c_beta/source/bin/report.php' with the charset : 'UTF-8'.
        at org.sonar.api.batch.AbstractSourceImporter.parseDirs(AbstractSourceImporter.java:84)
        at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:69)
        at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:60)
        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
        at org.sonar.batch.phases.Phases.execute(Phases.java:93)
        at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:143)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:111)
        at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:101)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:102)
        at org.sonar.batch.bootstrap.Module.start(Module.java:83)
        at org.sonar.batch.Batch.execute(Batch.java:100)
        at org.sonar.maven.SonarMojo.executeBatch(SonarMojo.java:152)
        at org.sonar.maven.SonarMojo.execute(SonarMojo.java:142)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
        at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:98)
        ... 21 more
Caused by: org.sonar.api.resources.DuplicatedSourceException: org.sonar.api.resources.File@10ade81[key=bin/report.php,dir=bin,filename=report.php,language=PHP]
        at org.sonar.batch.index.SourcePersister.saveSource(SourcePersister.java:45)
        at org.sonar.batch.index.DefaultPersistenceManager.setSource(DefaultPersistenceManager.java:78)
        at org.sonar.batch.index.DefaultIndex.setSource(DefaultIndex.java:402)
        at org.sonar.batch.DefaultSensorContext.saveSource(DefaultSensorContext.java:159)
        at org.sonar.api.batch.AbstractSourceImporter.parseDirs(AbstractSourceImporter.java:81)
        ... 37 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 23 seconds
[INFO] Finished at: Wed Feb 08 14:50:49 EET 2012
[INFO] Final Memory: 16M/42M
[INFO] ------------------------------------------------------------------------

It started to fall after unit-test were added to source dir.
Google search didn't give any clue.

The file is in utf-8:
report.php: text/plain; charset=utf-8

Any suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鸢与 2025-01-10 11:36:21

看起来像 Sonar 的 未解决的问题,由于相同的 php 文件名造成,源文件夹和测试文件夹。 java 也是如此。根据 this,这个问题应该在下一个版本中修复。

可能的解决方法:

  • 如果遇到此问题,可以尝试重命名(如果可能)
    导致分析失败的测试文件

Looks like an open issue with Sonar, caused due to the same php file name in say, source and test folders. The issue exists for java as well. According to this, this should be fixed in the next release.

Possible Workaround:

  • If you encounter this problem, you can try to rename (if possible)
    the test files that make the analysis fail
情场扛把子 2025-01-10 11:36:21

首先,您的所有源代码都是 UTF-8 编码的吗?
如果是这样,您是否尝试删除report.php源文件,看看是否不仅仅是这个类有问题?

First, are all your sources encoded in UTF-8?
If so, have you tried removing the report.php source file, just to see if it's not only this class that has a problem?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文