title: Changed Sonar web.context, now ant task fails
body: <p>I had a working sonar/jenkins installation, where sonar was installed on localhost:9000 and jenkins was on localhost:8080. I then wanted to hide those services behind Apache and protect them behind Crowd-authenticated account access.</p>
  
  <p>So first, I relocated Jenkins to localhost:8080/jenkins and proxied it. Which worked.</p>
  
  <p>Then I relocated Sonar to localhost:9000/sonar and proxied it. Which also worked.</p>
  
  <p>But now, when I try to execute the Sonar task from within the build script in Jenkins, I get the following error:</p>
  
  <pre><code>sonar:
  [sonar:sonar] Apache Ant version 1.7.1 compiled on April 26 2010
  [sonar:sonar] Sonar Ant Task version: 1.2
  [sonar:sonar] Loaded from: file:/usr/share/ant/lib/sonar-ant-task-1.2.jar
  [sonar:sonar] Sonar work directory: /var/lib/jenkins/jobs/buzzcartes/workspace/.sonar
  [sonar:sonar] Sonar server: http://localhost:9000
  
  BUILD FAILED
  org.sonar.batch.bootstrapper.BootstrapException: http://localhost:9000/api/server  /version
      at org.sonar.batch.bootstrapper.Bootstrapper.getServerVersion(Bootstrapper.java:71)
      at org.sonar.ant.SonarTask.checkSonarVersion(SonarTask.java:225)
      at org.sonar.ant.SonarTask.execute(SonarTask.java:188)
      at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
      at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:601)
      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:357)
      at org.apache.tools.ant.Target.performTasks(Target.java:385)
      at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
      at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
      at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
      at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
      at org.apache.tools.ant.Main.runBuild(Main.java:758)
      at org.apache.tools.ant.Main.startAnt(Main.java:217)
      at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
      at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
  Caused by: java.io.FileNotFoundException: http://localhost:9000/api/server/version
      at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1610)
      at java.net.URLConnection.getContent(URLConnection.java:748)
      at org.sonar.batch.bootstrapper.Bootstrapper.remoteContent(Bootstrapper.java:123)
      at org.sonar.batch.bootstrapper.Bootstrapper.getServerVersion(Bootstrapper.java:69)
      ... 18 more
  </code></pre>
  
  <p>I've updated the configuration in Jenkins to reflect the new location of <a href="http://localhost/sonar" rel="nofollow">http://localhost/sonar</a> so I'm not sure where the <a href="http://localhost:9000/" rel="nofollow">http://localhost:9000/</a> is now coming from. I've looked in a variety of config files so far with no joy and Google isn't turning up any good answers so far. Any pointers would be most welcome.</p>
  
  <p>Oh, my sonar task in build.xml looks like this:</p>
  
  <pre><code>&lt;target name="sonar" depends="compile"&gt;
       &lt;!-- list of mandatory Sonar properties --&gt;
      &lt;property name="sonar.sources" value="${basedir}/src" /&gt;
  
      &lt;!-- list of optional Sonar properties --&gt;
      &lt;property name="sonar.projectName" value="buzzcartes" /&gt;
      &lt;property name="sonar.binaries" value="${basedir}/build" /&gt;
      &lt;property name="sonar.tests" value="${basedir}/test" /&gt;
      &lt;property name="sonar.libraries" value="${basedir}/lib" /&gt;
  
      &lt;sonar:sonar key="com.benjasoft:buzzcartes" version="0.1-SNAPSHOT" xmlns:sonar="antlib:org.sonar.ant" /&gt; 
  </code></pre>
  
  <p>Thanks!</p>