The library sonar-ws-client is intented to help Java developers to use the Sonar web services.
Add these maven dependencies to your pom :
It's possible to use the version 4 of Commons HTTPClient instead of version 3.1 :
Be careful, Commons HTTPClient depends on commons-logging. If you use SLF4J, you should replace commons-logging by jcl-over-slf4j :
Using the client
Create the client
If the security is enabled, you have to define the credentials :
When using the lib Commons HttpClient 4.0, the constructor is slightly different :
For example to the get the code coverage of the project Struts :
The methods find() and findAll() accept queries to get measures, code source, rule violations, configuration, metric definitions and dependencies between resources. See Javadoc for more information.