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

Option to rename outputfiles:dependency-check-report #2634

Open
ChristianFehlinger opened this issue May 12, 2020 · 6 comments
Open

Option to rename outputfiles:dependency-check-report #2634

ChristianFehlinger opened this issue May 12, 2020 · 6 comments

Comments

@ChristianFehlinger
Copy link

I am using the command-line scanner in a ci-pipeline. (Used version Dependency-Check Core version 5.3.0)
I was searching for parameter to rename the output-files, but was not able to find something.
For example from dependency-check-report.xml to dependency-check-app1.xml

After a quick look into ReportGenerator.java, it looks like it is static.

    public static File getReportFile(String outputLocation, Format format) {
        File outFile = new File(outputLocation);
        if (outFile.getParentFile() == null) {
            outFile = new File(".", outputLocation);
        }
        final String pathToCheck = outputLocation.toLowerCase();
        if (format == Format.XML && !pathToCheck.endsWith(".xml")) {
            return new File(outFile, "dependency-check-report.xml");
        }
        if (format == Format.HTML && !pathToCheck.endsWith(".html") && !pathToCheck.endsWith(".htm")) {
            return new File(outFile, "dependency-check-report.html");
        }
        if (format == Format.JSON && !pathToCheck.endsWith(".json")) {
            return new File(outFile, "dependency-check-report.json");
        }
        if (format == Format.CSV && !pathToCheck.endsWith(".csv")) {
            return new File(outFile, "dependency-check-report.csv");
        }
        if (format == Format.JUNIT && !pathToCheck.endsWith(".xml")) {
            return new File(outFile, "dependency-check-junit.xml");
        }
        return outFile;
    }

Could it be a option to add a variable to the Settings.java?
So it would be possible to overwrite it with a properties.file.

@jeremylong
Copy link
Owner

If you are generating a single report format you can already rename the output file by using:

$ dependency-check.sh --out ./report.xml --format XML --scan ./path

@ChristianFehlinger
Copy link
Author

Thanks for that tip.
At the moment i am generating XML and HTML, but i think i could drop the HTML part.

But in generell i think it would be nice to define a name.

@jeremylong
Copy link
Owner

I'd agree, the option to specify the filename should be added. We accept PRs...

@majoba
Copy link

majoba commented Apr 12, 2021

I am using the mvn plugin and would be happy, if the option would be available to specify the report filename (eg including the version number for a better traceability...). Is there any progress?

@timonzi
Copy link

timonzi commented Jun 22, 2023

Same here. I would like to define the name using a Maven property, respectively a -D parameter.

AntoineLange pushed a commit to AntoineLange/DependencyCheck that referenced this issue Dec 18, 2024
@AntoineLange
Copy link

Would you consider something like this: #7262 ?

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

No branches or pull requests

5 participants