Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use a custom velocity template for reports? #4799

Closed
gesellix opened this issue Sep 1, 2022 · 3 comments
Closed

How to use a custom velocity template for reports? #4799

gesellix opened this issue Sep 1, 2022 · 3 comments
Labels

Comments

@gesellix
Copy link
Contributor

gesellix commented Sep 1, 2022

We're trying to create a JSON formatted report to ease the integration with our monitoring tools. The existing JSON report doesn't include the overiew/summary like the HTML report, so we're working on a custom template which might be proposed here as soon as we're confident that it makes sense for other users.

Looking at

* @param format the format the report should be written in (XML, HTML,
* JSON, CSV, ALL) or even the path to a custom velocity template (either
* fully qualified or the template name on the class path).
* @throws ReportException is thrown if there is an error creating out the
* reports
*/
public void write(String outputLocation, String format) throws ReportException {
we hoped that a custom report.vsl file could be used via CLI (e.g. as --format /path/to/report.vsl), but the CliParser fails at
if (line.hasOption(ARGUMENT.OUTPUT_FORMAT)) {
String validating = null;
try {
for (String format : getReportFormat()) {
validating = format;
Format.valueOf(format);
}
} catch (IllegalArgumentException ex) {
final String msg = String.format("An invalid 'format' of '%s' was specified. "
+ "Supported output formats are " + SUPPORTED_FORMATS, validating);
throw new ParseException(msg);
}
}

Can you tell how to provide a custom template?

@gesellix
Copy link
Contributor Author

gesellix commented Sep 1, 2022

I have opened #4800 as kind of a quick fix, because it seems like the custom templates are already working for the Ant/Maven plugins, and the CliParser being a bit too restrictive.

@jeremylong
Copy link
Owner

This will be included in the next release.

@gesellix
Copy link
Contributor Author

gesellix commented Sep 5, 2022

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants