Sonar 2.6 Adds Continuous Inspection Support for Ant Community

The Sonar team is proud to announce Sonar version 2.6. It is a tradition that we publish screenshots along with such an announce but for this one time, as the innovation is not “showable”, we will make an exception !

Prior to 2.6, Sonar had a very tight link with Maven because we leveraged Maven technology at project inception to get a Bootstrapper that was cheap to implement and simple to use. Indeed, you could analyze a project by running “mvn sonar:sonar” on any project, just having to write a small pom.xml to point source directory on non-maven projects. This kind of dream for Maven projects was sometimes considered as a nightmare by the ANT guys due to the pre-requisite of installing Maven.

We thought it was time with Sonar 2.6 to refactor the bootstrapper mechanism to remove its tight coupling with Maven. It is now very simple for projects that are not built with Maven to run Sonar analysis and of course we have made sure there is no impact for existing Maven ones.

Along with the new release, we have published a Sonar Ant task and a Sonar Standalone Runner. Next step is to help the Gradle community to have their own Sonar runner (see GRADLE-888).

So what does it mean to use the Sonar Ant task ? Something very simple and standard :

  • Download the Sonar Ant task
  • Update your Ant build script
  • Launch “ant sonar”
  • Be ready to improve quality

To get more information, see the documentation page. Our goal is to give as many power to the Ant users than to the Maven guys. So we’ve already started to work on the Sonar Jacoco plugin to be able to automatically launch unit tests from the Sonar Ant task in order to compute code coverage measures. Stay tuned, this feature should be available quickly.

The full content of Sonar 2.6 is available in the release notes. Please do not forget to read the install or upgrade guides. You are now ready to download the new version and enjoy it … with Ant if you want !

  • Great news, congratulations! I’ll try it out as soon as possible.

  • Sorry, I am new to all of this and being able to reuse test & coverage results would be a great improvement, but this is very cryptic for me:
    “…using the “-Dsonar.dynamic= reuseReports” parameter…following properties : sonar.cobertura.reportPath, sonar.clover.reportPath, sonar.surefire.reportsPath”.

    What should we do exactely, please.

    Many thanks

  • Hi jean-Michel, please use the Sonar User Mailing list (http://www.sonarsource.org/support/) to get some support. Thanks! Freddy.

  • Thanks Freddy, I finally figured it out (a break helped a lot ;).

  • any idea about this error?

    [sonar:sonar] Sonar version: 2.8

    BUILD FAILED
    /home/assure/projects/touchpoint/main/sonar.xml:20: javax.xml.parsers.FactoryConfigurationError: Provider com.icl.saxon.aelfred.SAXParserFactoryImpl not found
    at org.sonar.ant.SonarTask.delegateExecution(SonarTask.java:170)
    at org.sonar.ant.SonarTask.execute(SonarTask.java:151)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor2.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:105)
    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:1329)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.Main.runBuild(Main.java:698)
    at org.apache.tools.ant.Main.startAnt(Main.java:199)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
    Caused by: javax.xml.parsers.FactoryConfigurationError: Provider com.icl.saxon.aelfred.SAXParserFactoryImpl not found
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:134)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:56)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:105)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:76)
    at org.sonar.ant.Launcher.initLogging(Launcher.java:133)
    at org.sonar.ant.Launcher.execute(Launcher.java:59)
    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.ant.SonarTask.delegateExecution(SonarTask.java:167)
    … 17 more
    — Nested Exception —
    javax.xml.parsers.FactoryConfigurationError: Provider com.icl.saxon.aelfred.SAXParserFactoryImpl not found
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:134)
    at ch.qos.logback.core.joran.event.SaxEventRecorder.recordEvents(SaxEventRecorder.java:56)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:105)
    at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:76)
    at org.sonar.ant.Launcher.initLogging(Launcher.java:133)
    at org.sonar.ant.Launcher.execute(Launcher.java:59)
    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.ant.SonarTask.delegateExecution(SonarTask.java:167)
    at org.sonar.ant.SonarTask.execute(SonarTask.java:151)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
    at sun.reflect.GeneratedMethodAccessor2.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:105)
    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:1329)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
    at org.apache.tools.ant.Main.runBuild(Main.java:698)
    at org.apache.tools.ant.Main.startAnt(Main.java:199)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

  • Paul, this is not the right place to ask for help. Please use the user mailing list instead (see http://www.sonarsource.org/support/support/).
    Thanks!

Leave a reply