title: Getting sonar-runner to work with C code
body: <p>I am trying to use <a href="http://www.sonarsource.org/" rel="nofollow">sonar</a>. The server is up and running (using the default embedded derby database), serving a web page with no projects. Then I was planning to use sonar-runner to examine the source code, but I cannot get it to work even with the simplest hello world program. Any hints on what is missing/I am doing wrong?</p>
  
  <pre><code>(hlovdal) localhost:/work/sonar&gt;wget -q http://repository.codehaus.org/org/codehaus/sonar-plugins/sonar-runner/1.1/sonar-runner-1.1.zip
  (hlovdal) localhost:/work/sonar&gt;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&gt;export SONAR_RUNNER_HOME=/work/sonar/sonar-runner-1.1
  (hlovdal) localhost:/work/sonar&gt;$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 &lt;arg&gt;     Define property
  (hlovdal) localhost:/work/sonar&gt;
  </code></pre>
  
  <p>But trying to run sonar-runner fails:</p>
  
  <pre><code>(hlovdal) localhost:/work/sonar&gt;cd helloworld/
  (hlovdal) localhost:/work/sonar/helloworld&gt;cat main.c 
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(int argc, char *argv[])
  {
          printf("hello world\n");
          return EXIT_SUCCESS;
  }
  (hlovdal) localhost:/work/sonar/helloworld&gt;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&gt;$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&gt;
  </code></pre>