SonarQubeCommunity / sonar-pdf-report

80 stars 81 forks source link

fix deprecated issues in order to make pdf plugin compatible with sonarqube 5.0 #7

Closed laurents59 closed 9 years ago

laurents59 commented 9 years ago

still compatible with 4.5.1 LTS (base api). tested ok with 5.0 sonarqube

amuniz commented 9 years ago

I'll review it and come back with results. Thanks for the contribution!

amuniz commented 9 years ago

This PR is related to https://jira.codehaus.org/browse/SONARPLUGINS-3852

jswaelens commented 9 years ago

Managed to build this and tested OK on 5.1 as well, thanks!

joffroy59 commented 9 years ago

are you sure it is OK for 5.1 because it still using deprecated parameters "componentRoots" of the ws api search/issue wich seems to be deprecated (seems to be replace by "componentKeys",...) I make a pull request on forked : laurents59/sonar-pdf-report

laurents59 commented 9 years ago

Hello The goal of the fix (pull request) was to treat 4.X deprecations that has been removed in 5.X, in order to make the plugin compatible with latest LTS of sonarqube, but also to have compatibility with latest 5.X releases. 5.X deprecations should be treated with another version of the plugin, which then should be based on 5.X api.

jswaelens commented 9 years ago

Hi,

Yes, at least we where able to build & run it to the latest version - reports where generated and could't see flaws in it visually.

cheers

Haratsu commented 9 years ago

Hi laurebts59 thanks for providing the pull request. Works like a charme

amuniz commented 9 years ago

Starting PR merge process.

Code conventions :+1: Tested with SonarQube 4.5.1 LTS :+1: Tested with SonarQube 5.0.1 :+1: Tested with SonarQube 5.1 :x:

In 5.1 the analysis fails with this stack trace:

org.sonar.report.pdf.entity.exception.ReportException: Can't retrieve project info. Parent project node is empty. Authentication?
at org.sonar.report.pdf.builder.ProjectBuilder.initializeProject(ProjectBuilder.java:125)
at org.sonar.report.pdf.PDFReporter.getProject(PDFReporter.java:132)
at org.sonar.report.pdf.PDFReporter.getReport(PDFReporter.java:82)
at org.sonar.report.pdf.batch.PDFGenerator.execute(PDFGenerator.java:107)
at org.sonar.report.pdf.batch.PDFPostJob.executeOn(PDFPostJob.java:80)
at org.sonar.batch.phases.PostJobsExecutor.execute(PostJobsExecutor.java:62)
at org.sonar.batch.phases.PostJobsExecutor.execute(PostJobsExecutor.java:52)

It seems that the project is not "available" in SQ just after the first analysis (HTTP 404 is returned):

[INFO] [13:29:23.902] Retrieving project info for org.codehaus.sonar-plugins:sonar-pdfreport-plugin
[DEBUG] [13:29:23.936] Set parameter http.socket.timeout = 30000
[DEBUG] [13:29:23.951] HttpConnectionManager.getConnection:  config = HostConfiguration[host=http://localhost:9000], timeout = 0
[DEBUG] [13:29:23.952] Allocating new connection, hostConfig=HostConfiguration[host=http://localhost:9000]
[DEBUG] [13:29:23.977] Preemptively sending default basic credentials
[DEBUG] [13:29:23.989] Authenticating with BASIC <any realm>@localhost:9000
[DEBUG] [13:29:23.989] Credential charset not configured, using HTTP element charset
[DEBUG] [13:29:23.993] Open connection to localhost:9000
[DEBUG] [13:29:23.998] >> "GET /api/resources?resource=org.codehaus.sonar-plugins%3Asonar-pdfreport-plugin&depth=0&verbose=false& HTTP/1.1[\r][\n]"
[DEBUG] [13:29:23.999] Adding Host request header
[DEBUG] [13:29:24.017] >> "Accept: application/json[\r][\n]"
[DEBUG] [13:29:24.018] >> "Authorization: Basic Og==[\r][\n]"
[DEBUG] [13:29:24.018] >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
[DEBUG] [13:29:24.018] >> "Host: localhost:9000[\r][\n]"
[DEBUG] [13:29:24.018] >> "[\r][\n]"
[DEBUG] [13:29:24.084] << "HTTP/1.1 404 Not Found[\r][\n]"
[DEBUG] [13:29:24.084] << "HTTP/1.1 404 Not Found[\r][\n]"
[DEBUG] [13:29:24.086] << "Server: Apache-Coyote/1.1[\r][\n]"
[DEBUG] [13:29:24.086] << "Set-Cookie: JSESSIONID=684432C5816DB5FDE65B1DAF8B27C3CE; Path=/; HttpOnly[\r][\n]"
[DEBUG] [13:29:24.086] << "Cache-Control: no-cache[\r][\n]"
[DEBUG] [13:29:24.086] << "X-Runtime: 42[\r][\n]"
[DEBUG] [13:29:24.086] << "Content-Type: application/json;charset=utf-8[\r][\n]"
[DEBUG] [13:29:24.086] << "Content-Length: 99[\r][\n]"
[DEBUG] [13:29:24.086] << "Date: Mon, 18 May 2015 11:29:23 GMT[\r][\n]"
[DEBUG] [13:29:24.086] << "[\r][\n]"

Any other analysis after the first one, works fine.

So, this PR makes the plugin compatible with 5.0 (and keep compat with the last LTS). Compatibility with SQ 5.1 (or more) will be managed later.

dmiralles commented 9 years ago

Hello,

When will be available this plugin? I would like to test it but I can't download it.

Thanks for your excellent job. Regards, David.

ashokjha commented 8 years ago

Hello, Started using SonarQube 5.2 , however found PDF report plugin not supported for the same. Is there any change which needs to be done before applying the plugin. Or if change in report plugin itself required advice will be of great help. pdf report plugin I'm using is sonar-pdfreport-plugin-1.4 Regards, Ashok