gpt4 book ai didi

java - Sonar ANT 任务集成错误

转载 作者:行者123 更新时间:2023-12-01 04:56:27 24 4
gpt4 key购买 nike

Java and ANT versions:
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)

Apache Ant(TM) version 1.8.4 compiled on May 22 2012

Sonar version: 3.3.2

Sonar Ant Task version: 2.0, using sonar-ant-task-2.0.jar

当我运行构建脚本时,出现以下错误。我也尝试在构建脚本中设置以下属性,但不断收到以下错误。如果有人有任何解决方案,请告诉我。

sonar.sourceEncoding with value Windows-1252 

sonar.supportSourceFileDuplications with value as true

Error:

BUILD FAILED

D:\TestProj\build-sonar.xml:40: org.sonar.api.utils.SonarException: Unable to read and import the source file : 'D:\TestProj\WEB-INF\src\com\iwf\ImageSearchCommand.java' with the charset : 'windows-1252'.
at org.sonar.plugins.java.JavaSourceImporter.importSource(JavaSourceImporter.java:86)
at org.sonar.plugins.java.JavaSourceImporter.parseDirs(JavaSourceImporter.java:70)
at org.sonar.plugins.java.JavaSourceImporter.analyse(JavaSourceImporter.java:63)
at org.sonar.plugins.java.JavaSourceImporter.analyse(JavaSourceImporter.java:59)
at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64)
at org.sonar.batch.phases.Phases.execute(Phases.java:97)
at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:128)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:114)
at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:104)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:121)
at org.sonar.batch.bootstrap.Module.start(Module.java:83)
at org.sonar.batch.Batch.execute(Batch.java:104)
at org.sonar.runner.DeprecatedAntLauncher.execute(DeprecatedAntLauncher.java:83)
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.sonar.runner.DeprecatedAntTaskExecutor.delegateExecution(DeprecatedAntTaskExecutor.java:110)
at org.sonar.runner.DeprecatedAntTaskExecutor.execute(DeprecatedAntTaskExecutor.java:65)
at org.sonar.ant.SonarTask.launchAnalysis(SonarTask.java:86)
at org.sonar.ant.SonarTask.execute(SonarTask.java:75)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:392)
at org.apache.tools.ant.Target.performTasks(Target.java:413)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:811)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)Caused by: org.sonar.api.resources.DuplicatedSourceException: Duplicate source for resource: com.iwf.ImageSearchCommand
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:419)
at org.sonar.batch.DefaultSensorContext.saveSource(DefaultSensorContext.java:161)
at org.sonar.plugins.java.JavaSourceImporter.importSource(JavaSourceImporter.java:83)

最佳答案

听起来像:

根本原因是源文件和测试文件同名。解决方案是从 Sonar 分析中排除测试文件

关于java - Sonar ANT 任务集成错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14041651/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com