2

can anyone tell me how to integrate Sonar and Apache Buildr?

I downloaded sonar.rb from https://github.com/apache/buildr and placed it in /var/lib/gems/1.8/gems/buildr-1.4.6/addon/buildr

But I don't know how to call this task from my project. I have already added a

require 'buildr/sonar'
include Buildr::Sonar

I don't know where I have to configure the sonar properties.

Thank you, Soccertrash

Soccertrash
  • 1,830
  • 3
  • 28
  • 48

1 Answers1

2

The Sonar extension uses the underlying ant task and passes parameters from buildr to ant. The parameters that you can use will be documented in the next release of Buildr. But to get you started here is a simple example that uses all the configuration parameters. The only property that must be set is "enabled", while the remainder attempt to have sensible defaults.

require 'buildr/sonar'

define "foo" do
  project.version = "1.0.0"

  define "bar" do ... end

  sonar.enabled = true
  sonar.project_name = 'Foo-Project'
  sonar.key = 'foo:project'
  sonar.jdbc_url = 'jdbc:jtds:sqlserver://example.org/SONAR;instance=MyInstance;SelectMethod=Cursor'
  sonar.jdbc_driver_class_name = 'net.sourceforge.jtds.jdbc.Driver'
  sonar.jdbc_username = 'sonar'
  sonar.jdbc_password = 'secret'
  sonar.host_url = 'http://127.0.0.1:9000'
  sonar.sources << project('foo:bar')._(:source, :main, :java)
  sonar.binaries << project('foo:bar').compile.target
  sonar.libraries << project('foo:bar').compile.dependencies

end
Peter Donald
  • 461
  • 2
  • 5
  • I have added just the sonar.enabled = true and also all other properties. But There is no output message that Sonar task was executed. Do I have to put the Sonar.rb somewhere else? I just run "buildr" or "buildr install" but the task is not executed. – Soccertrash May 24 '12 at 15:27
  • I have also installed "gem install Antwrap" -> no effect – Soccertrash May 25 '12 at 05:48