gpt4 book ai didi

c - 让 sonar-runner 使用 C 代码

转载 作者:行者123 更新时间:2023-11-30 16:01:11 25 4
gpt4 key购买 nike

我正在尝试使用sonar 。服务器已启动并正在运行(使用默认的嵌入式 derby 数据库),提供没有项目的网页。然后我打算使用 sonar-runner 来检查源代码,但即使使用最简单的 hello world 程序也无法让它工作。关于缺少什么/我做错了什么有任何提示吗?

(hlovdal) localhost:/work/sonar>wget -q http://repository.codehaus.org/org/codehaus/sonar-plugins/sonar-runner/1.1/sonar-runner-1.1.zip
(hlovdal) localhost:/work/sonar>unzip sonar-runner-1.1.zip
Archive: sonar-runner-1.1.zip
creating: sonar-runner-1.1/
...
inflating: sonar-runner-1.1/lib/sonar-runner.jar
(hlovdal) localhost:/work/sonar>export SONAR_RUNNER_HOME=/work/sonar/sonar-runner-1.1
(hlovdal) localhost:/work/sonar>$SONAR_RUNNER_HOME/bin/sonar-runner -h

usage: sonar-runner [options]

Options:
-h,--help Display help information
-X,--debug Produce execution debug output
-D,--define <arg> Define property
(hlovdal) localhost:/work/sonar>

但是尝试运行 sonar-runner 失败:

(hlovdal) localhost:/work/sonar>cd helloworld/
(hlovdal) localhost:/work/sonar/helloworld>cat main.c
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
printf("hello world\n");
return EXIT_SUCCESS;
}
(hlovdal) localhost:/work/sonar/helloworld>grep -v -E '^#|^$' sonar-runner.properties
sonar.projectKey=helloworld
sonar.projectName=Hello world
sonar.projectVersion=1.0
sonar.language=c
sources=/work/sonar/helloworld
sonar.sourceEncoding=UTF-8
(hlovdal) localhost:/work/sonar/helloworld>$SONAR_RUNNER_HOME/bin/sonar-runner
Runner settings: /work/sonar/sonar-runner-1.1/conf/sonar-runner.properties
Runner version: 1.1
Server: http://localhost:9000
Work directory: /work/sonar/helloworld/.sonar
[INFO] Database dialect class org.sonar.jpa.dialect.Derby
[INFO] Initializing Hibernate
Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public void org.sonar.batch.index.DefaultIndex.start()', instance 'org.sonar.batch.index.DefaultIndex@3d57211f, java.lang.RuntimeException: wrapper
at org.sonar.runner.Runner.delegateExecution(Runner.java:155)
at org.sonar.runner.Runner.execute(Runner.java:58)
at org.sonar.runner.Main.main(Main.java:52)
Caused by: org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public void org.sonar.batch.index.DefaultIndex.start()', instance 'org.sonar.batch.index.DefaultIndex@3d57211f, java.lang.RuntimeException: wrapper
at org.picocontainer.monitors.NullComponentMonitor.lifecycleInvocationFailed(NullComponentMonitor.java:77)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:132)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:115)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
at org.picocontainer.behaviors.Stored.start(Stored.java:110)
at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:996)
at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:989)
at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:746)
at org.sonar.batch.bootstrap.Module.start(Module.java:88)
at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:96)
at org.sonar.batch.bootstrap.Module.start(Module.java:89)
at org.sonar.batch.Batch.execute(Batch.java:74)
at org.sonar.runner.Launcher.executeBatch(Launcher.java:60)
at org.sonar.runner.Launcher.execute(Launcher.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.sonar.runner.Runner.delegateExecution(Runner.java:152)
... 2 more
Caused by: java.lang.RuntimeException: wrapper
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.monitorAndThrowReflectionLifecycleException(ReflectionLifecycleStrategy.java:130)
... 22 more
Caused by: java.lang.NullPointerException
at org.sonar.api.resources.Resource.hashCode(Resource.java:242)
at java.util.HashMap.put(HashMap.java:389)
at org.sonar.batch.index.DefaultIndex.doStart(DefaultIndex.java:98)
at org.sonar.batch.index.DefaultIndex.start(DefaultIndex.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
... 21 more
(hlovdal) localhost:/work/sonar/helloworld>

最佳答案

projectKey 看起来不正确,它应该类似于 xxx:yyy

关于c - 让 sonar-runner 使用 C 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6980386/

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