Retrieve ReportId from Maven-Plugin - Sonatype Lifecycle & Repository Firewall - Sonatype Community

Retrieve ReportId from Maven-Plugin

post by wiesner.christian on Feb 27, 2023

Hello,

When using the mvn-plugin in this way

mvn com.sonatype.clm:clm-maven-plugin:index com.sonatype.clm:clm-maven-plugin:evaluate …

I want to access the generated report in the ongoing build-process. Therefore, I need the reportId. How can I retrieve the reportId from the plugin.

Thank you,

Christian

post by mfrost on Feb 28, 2023

Hey @wiesner.christian - I reached out to our Integrations team about this. You can generate a result file for the evaluate goal by using the clm.resultFile parameter.

For example…

mvn ... com.sonatype.clm:clm-maven-plugin:evaluate ... -Dclm.resultFile=result.json

You can open the result.json file and look for the “reportHtmlUrl” entry; its value is the link to the application report, and the last path segment is the report ID (e.g. 0cdd1cbeff4e4c34afcda69a043e4b38 below).

{
  "applicationId" : "local-iq-app",
  "scanId" : "0cdd1cbeff4e4c34afcda69a043e4b38",
  "reportHtmlUrl" : "http://localhost:8070/ui/links/application/local-iq-app/report/0cdd1cbeff4e4c34afcda69a043e4b38",
  ...
}

Hopefully that helps some!

post by jeff.wise on Mar 7, 2023

See Sonatype CLM for Maven for more details on the clm.resultFile parameter.